Created
April 18, 2016 08:30
-
-
Save pkulev/fa86b2aacdd822b187f7098826c285f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def normalize(vector): | |
... normalized = [] | |
... for elem in vector: | |
... normalized.append(elem / 255.) | |
... return normalized | |
... | |
>>> normalize((1,2,3)) | |
[0.00392156862745098, 0.00784313725490196, 0.011764705882352941] | |
>>> normalize((0, 0, 0)) | |
[0.0, 0.0, 0.0] | |
>>> normalize((255,255,255)) | |
[1.0, 1.0, 1.0] | |
>>> normalize((128,128,128)) | |
[0.5019607843137255, 0.5019607843137255, 0.5019607843137255] | |
>>> normalize((128,128,127)) | |
[0.5019607843137255, 0.5019607843137255, 0.4980392156862745] | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment