I am wondering why I am getting none for my grads in the following code:
import tensorflow.keras.losses as losses
loss = losses.squared_hinge(y_true, y_pred)
from tensorflow.keras import backend as K
grads = K.gradients(loss, CNN_model.input)[0]
iterate = K.function([CNN_model.input], [loss, grads])
my CNN_model.input is:
<tf.Tensor 'conv2d_3_input:0' shape=(?, 28, 28, 1) dtype=float32>
my loss is:
<tf.Tensor 'Mean_3:0' shape=(1,) dtype=float64>
Note: I am passing the predicted output of an SVM as y_pred for my application if that is of importance.