ValueError: operands could not be broadcast together with shapes (1,8) (1,7)

Exercise 5 - translate

I have more-less correct output of model but I have error when run test


I’m not familiar with this assignment, but notice in the one example of a translation output by your code that the β€œeu” is duplicated. The input was not β€œI I love languages”, right? Is that what is supposed to be happening? Given that there seems to be some kind of β€œoff by one” error happening, that seems like something worth investigating.

Yeah, I found it strange too. But I don’t have any ideas, what could I do wrong

I’ve just restarted notebook. I have correct outputs after new training, but still have error in tests

But now it is

ValueError: operands could not be broadcast together with shapes (1,7) (1,6)

@someone555777

is your issue resolved as there is another post created by you stating it is related!!!

Regards
DP

This is two separate assigments. But probably, that the source is the same.

Hi @someone555777

Ok so is this issue resolved as I can see one of the mentor is responding you here, if not resolved then send the screenshot of grade cell translate via personal DM

Regards
DP

Hi @someone555777

For code lines

  1. Convert the original string into a tensor and Vectorize the text using the correct vectorizer, you are converting texts not text (Starting two code line has this issue. Refer the image shared in the below pinned comment link.

Other code lines which are incorrect,

  1. Initial hidden and cell states should be tensors of zeros with shape (1, UNITS)

  2. Iterate for max_length iterations(The pinned comment has the solution to your incorrectly recalled iteration.)

  3. If done then break out of the loop

image

Make sure you go through the pinned comment link which should then completely resolve issue for the grade cell in question here

In case you develop any new error, let me know.

Regards
DP

1 Like

Okay, usage of tf.zeros has resolved an issue and I passed tests, but I have output like this. Is it ok?

Also, I’ve left context = english_vectorizer(text).to_tensor(). Is it not correct vectorizer?

It is ok in my lab, isn’t it?

no even context need to have texts and not text

ahah, you are correct, usage of texts, that is not from the context of function is working better now. Thank you!

1 Like

shall I close this thread, if your issue is addressed?

Yeah! thank you one more time for help