Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in week 3 Machine Translation #1

Open
Yumlembam opened this issue Sep 17, 2018 · 4 comments
Open

ERROR in week 3 Machine Translation #1

Yumlembam opened this issue Sep 17, 2018 · 4 comments

Comments

@Yumlembam
Copy link

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)"

@piyushsoni27
Copy link

Is there any resolution for this error yet? I am facing similar error. I am using Keras- "2.2.4"

@esraahisham753
Copy link

I have the same error also

@shanghaiJ
Copy link

shanghaiJ commented Dec 9, 2020

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.

@alfredomaussa
Copy link

alfredomaussa commented Dec 22, 2020

i changed this line of code and worked:

prediction = model.predict([np.einsum('ij->ji', source).reshape((1,30,37)), s0[:1], c0[:1]])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants