Week 3 assignment error

Hi,help
im in tensorflow_introduction assignment .
despite passing the test cases im getting an error after using the one_hot_matrix function(in the subsequent cells called new_ytest)

ValueError: Cannot reshape a tensor with 6 elements to shape [4,1] (4 elements) for ‘{{node Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32](one_hot, Reshape/shape)’ with input shapes: [6], [2] and with input tensors computed as partial shapes: input[1] = [4,1].

im genius,so i was not looking at the call
the default value was 6,and i hardcoded the shape in my one_hot function…
please do not bother i’ve got it
___

1 Like

like you said…I change following from define function header

GRADED FUNCTION: one_hot_matrix

def one_hot_matrix(label, depth=4): # from original 6 to 4 and now problem solved

do not hard code 6 in the function input…bad idea. it messes up with the later score calculation