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

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