Deep-Learning-Specialization-Coursera
Deep-Learning-Specialization-Coursera copied to clipboard
ERROR in week 3 Machine Translation
Hi,
In the line ----> 8 prediction = model.predict([source, s0, c0])
why am i getting the error "Error when checking : expected X to have 3 dimensions, but got array with shape (37, 30)"
Is there any resolution for this error yet? I am facing similar error. I am using Keras- "2.2.4"
I have the same error also
I edited code with this:
source = string_to_int(example, Tx, human_vocab) source = np.array(list(map(lambda x: to_categorical(x, num_classes=len(human_vocab)), source))) ttt=np.expand_dims(source,axis=0) print(ttt.shape) prediction = model.predict([ttt, s0, c0])
Then, I got another error: ValueError: Data cardinality is ambiguous: x sizes: 1, 10000, 10000 Please provide data which shares the same first dimension.
I downgraded TF version to 2.0.0 instead of 2.3.0.
Anybody able to solve the issue? I am stuck on this.
i changed this line of code and worked:
prediction = model.predict([np.einsum('ij->ji', source).reshape((1,30,37)), s0[:1], c0[:1]])