tf.hessians
tf.hessians
tf.hessians
hessians( ys, xs, name='hessians', colocate_gradients_with_ops=False, gate_gradients=False, aggregation_method=None )
Defined in tensorflow/python/ops/gradients_impl.py
.
See the guide: Training > Gradient Computation
Constructs the Hessian of sum of ys
with respect to x
in xs
.
hessians()
adds ops to the graph to output the Hessian matrix of ys
with respect to xs
. It returns a list of Tensor
of length len(xs)
where each tensor is the Hessian of sum(ys)
. This function currently only supports evaluating the Hessian with respect to (a list of) one- dimensional tensors.
The Hessian is a matrix of second-order partial derivatives of a scalar tensor (see https://en.wikipedia.org/wiki/Hessian_matrix for more details).
Args:
-
ys
: ATensor
or list of tensors to be differentiated. -
xs
: ATensor
or list of tensors to be used for differentiation. -
name
: Optional name to use for grouping all the gradient ops together. defaults to 'hessians'. -
colocate_gradients_with_ops
: Seegradients()
documentation for details. -
gate_gradients
: Seegradients()
documentation for details. -
aggregation_method
: Seegradients()
documentation for details.
Returns:
A list of Hessian matrices of sum(y)
for each x
in xs
.
Raises:
-
LookupError
: if one of the operations betweenxs
andys
does not have a registered gradient function. -
ValueError
: if the arguments are invalid or not supported. Currently, this function only supports one-dimensionalx
inxs
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/hessians