7ee672fda5a01e29375439b6a18fb1971f90d3c5,pymanopt/autodiff/backends/_tensorflow.py,_TensorFlowBackend,compute_hessian,#_TensorFlowBackend#,92
Before Change
@Backend._assert_backend_available
def compute_hessian(self, objective, argument):
if not isinstance(argument, list):
argA = tf.zeros_like(argument)
tfhess = _hessian_vector_product(objective, [argument], [argA])
def hess(x, a):
feed_dict = {argument: x, argA: a}
return self._session.run(tfhess[0], feed_dict)
else:
argA = [tf.zeros_like(arg) for arg in argument]
tfhess = _hessian_vector_product(objective, argument, argA)
def hess(x, a):
feed_dict = {i: d for i, d in zip(argument+argA, x+a)}
return self._session.run(tfhess, feed_dict)
return hess
TensorFlow = make_graph_backend_decorator(_TensorFlowBackend)
After Change
@Backend._assert_backend_available
def compute_hessian(self, function, arguments):
flattened_arguments = flatten_arguments(arguments)
if len(flattened_arguments) == 1:
(argument,) = flattened_arguments
zeros = tf.zeros_like(argument)
hessian = _hessian_vector_product(function, [argument], [zeros])
def unary_hessian(point, vector):
feed_dict = {argument: point, zeros: vector}
return self._session.run(hessian[0], feed_dict)
return unary_hessian
zeros = [tf.zeros_like(argument) for argument in flattened_arguments]
hessian = _hessian_vector_product(function, flattened_arguments, zeros)
def nary_hessian(points, vectors):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 8
Instances
Project Name: pymanopt/pymanopt
Commit Name: 7ee672fda5a01e29375439b6a18fb1971f90d3c5
Time: 2020-01-27
Author: niklas.koep@gmail.com
File Name: pymanopt/autodiff/backends/_tensorflow.py
Class Name: _TensorFlowBackend
Method Name: compute_hessian
Project Name: pymanopt/pymanopt
Commit Name: e97a5389cd4169b54ded7eb173fc0d4d3f4cf8d5
Time: 2020-01-27
Author: niklas.koep@gmail.com
File Name: pymanopt/autodiff/backends/_tensorflow.py
Class Name: _TensorFlowBackend
Method Name: compute_gradient
Project Name: neurodsp-tools/neurodsp
Commit Name: c766ed7709046b9d0377bd5e07f8d0a363c26cb8
Time: 2019-03-23
Author: tdonoghue@ucsd.edu
File Name: neurodsp/sim/combined.py
Class Name:
Method Name: sim_combined