Open CHH3213 opened 3 years ago
https://stackoverflow.com/questions/59590766/how-do-i-get-the-gradient-of-a-keras-model-with-respect-to-its-inputs
x_tensor = tf.convert_to_tensor(input_data, dtype=tf.float32) with tf.GradientTape() as t: t.watch(x_tensor) output = model(x_tensor) result = output gradients = t.gradient(output, x_tensor)
tensorflow训练得到的神经网络求梯度
https://stackoverflow.com/questions/59590766/how-do-i-get-the-gradient-of-a-keras-model-with-respect-to-its-inputs