For example, I need to compute the gradient of the cross_entropy
with respect to x
, but I need to apply another value to the gradient function.
That is:
f'(x)|x = x_t
I think tf.gradients()
function will only give the gradient at x = x
.
So does tensorflow provide any of this feature?
The result of
tf.gradients
is a tensor (list of tensors in general), not a float value. In a way, this tensor is a function: it can be evaluated in any point. The client only needs to feed the desired input value.Example: