I ran into this error when I used this code
Its not nice posting your code here. The label shape and logits (predictions) are of not the same shape. The problem has arisen in your calculation of the expected_output. Reconsider that line calculation.
I’ve tried everything and nothing seems to work. Could you please provide the correction I need to make? I’m out of depth
@harish5p,
Look at the example in Ungraded Lab 3: Saliency in the “Compute Gradients” section, and also in the “Saliency” lecture video to see how they calculate expected_output there.
As a test, you can temporarily add some print statements in your code to print the shape of expected_output as you’ve calculated it compared with how it would look if you used the approach shown in these examples. You might also want to temporarily print expected_output itself to get a sense of what that looks like with both implementations.