The optic nerve function is to transfer visual information from the retina to the vision centers of the brain via electrical impulses .