Keras.backend.gradients function


the Keras.backend.gradients function returns a list with None in the first exercise. I was not able to solve the problem. Anyone any idea how to solve it?

Hi @Marko_Zlatic,

Is it possible to share the contents of your error and output?
Or could you explain the situation in more detail?
It might be helpful for us.

I agree with your suspicion.
The keras.backend.gradients should return a gradient tensor.

Best regards,

1 Like

Hi @Marko_Zlatic,

Two reasons why your Ex 1 was not working:

  • You had changed something in your assignment before Ex 1 which shouldn’t have been changed. It was causing the exercise to fail. .
  • There are a few mistakes in your Ex 1.

Your mistakes:

  • You are not fetching the correct output of the model in output_with_batch_dim.
  • You are calculating weights incorrectly.
  • for cam, you have made a typo. Instead of weights you have written weigths (notice the places of t and h are swapped)