TypeError: mul got incompatible shapes for broadcasting

Hi,

I wanted to report that I got a notification saying that the notebook was changed and after using the new version and double-checking all the implementation code for this very same training step, I’m seeing some suspicious dimension mismatch. This is the error I’m getting when trying to train the model:

TypeError: mul got incompatible shapes for broadcasting: (32, 2), (16, 2).

There are a bunch of cells that we are not supposed to touch and after double-checking all possible values I can’t seem to really find the issue. Can that be an issue with this latest notebook update?

Hello @Jose_Leal_Domingues
I am not mentor of NLP. So I couldn’t help here.
But before a NLP mentor attends your question, you can search the forum using the key words in the errors which may help you to solve this. I could see few posts which are related to your error. That will save your time

Thank you, that was helpful and pushed me to dig a little more. For future students, if this error happens to you try to double-check your data_generator implementation and make sure it works for different batches. The test doesn’t test it, so it doesn’t matter it passed.

1 Like

I have to thank you for this. I was getting an error with shapes where the first dimension was twice what it was supposed to be. My data_generator function was the issue and after going back through it, I was able to fix my mistake.

1 Like

This helped me in fixing what I had done wrong. I had following line incorrect in data_generator.

target_pos = [1] * n_to_take # correct

target_pos = [1] * len_n_pos #incorrect

2 Likes

Thank you!. That was my error.