Created
September 7, 2017 00:32
-
-
Save f0nzie/f523b0f3685caa73e887b273f080adef to your computer and use it in GitHub Desktop.
Convert a 3D array to a column vector
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 image2vector(image): | |
""" | |
Argument: | |
image -- a numpy array of shape (length, height, depth) | |
Returns: | |
v -- a vector of shape (length*height*depth, 1) | |
""" | |
v = image.reshape((image.shape[0] * image.shape[1] * image.shape[2], 1)) | |
return v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment