execute_with_gradients

ivy.execute_with_gradients(func, xs, f=None)[source]

Call function func with input of xs variables, and return func first output y, the gradients [dy/dx for x in xs], and any other function outputs after the returned y value

Parameters
  • func (function) – Function for which we compute the gradients of the output with respect to xs input.

  • xs (sequence of variables) – Variables for which to compute the function gradients with respective to.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.

Returns

the function first output y, the gradients [dy/dx for x in xs], and any other extra function outputs


Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty