I have CNN models trained using Keras with Tensorflow backend. And I want to visualize my CNN filters with this tutorial: https://blog.keras.io/how-convolutional-neural-networks
I too had faced the same error @Jexus. For me the problem was:
loss variable was None object. I had used
loss.assign_add(....)
instead of
loss = loss + .....
After changing that as mentioned, the loss was returning a tensor and hence
grads = K.gradients(loss, model.input)[0]
wasn't returning None.