I keep receiving the following error for optional assignment C1 W2: “NameError: name ‘image2vector_test’ is not defined” for Exercise 5
Exercise 5 - image2vector
Implement image2vector() that takes an input of shape (length, height, 3) and returns a vector of shape (lengthheight3, 1). For example, if you would like to reshape an array v of shape (a, b, c) into a vector of shape (a*b,c) you would do:
v = v.reshape((v.shape[0] * v.shape[1], v.shape[2])) # v.shape[0] = a ; v.shape[1] = b ; v.shape[2] = c
- Please don’t hardcode the dimensions of image as a constant. Instead look up the quantities you need with
image.shape[0], etc. - You can use v = v.reshape(-1, 1). Just make sure you understand why it works.