e97a5389cd4169b54ded7eb173fc0d4d3f4cf8d5,pymanopt/autodiff/backends/_tensorflow.py,_TensorFlowBackend,compute_gradient,#_TensorFlowBackend#,68
Before Change
tfgrad = tf.gradients(objective, argument)
if not isinstance(argument, list):
def grad(x):
feed_dict = {argument: x}
return self._session.run(tfgrad[0], feed_dict)
else:
def grad(x):
feed_dict = {i: d for i, d in zip(argument, x)}
return self._session.run(tfgrad, feed_dict)
return grad
@Backend._assert_backend_available
def compute_hessian(self, objective, argument):
After Change
@Backend._assert_backend_available
def compute_gradient(self, function, arguments):
flattened_arguments = flatten_arguments(arguments)
gradient = tf.gradients(function, flattened_arguments)
if len(flattened_arguments) == 1:
(argument,) = flattened_arguments
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
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: 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: 58bae639b6cfbebe1d11410a2069bc28f1873540
Time: 2020-01-27
Author: niklas.koep@gmail.com
File Name: pymanopt/autodiff/backends/_tensorflow.py
Class Name: _TensorFlowBackend
Method Name: is_compatible