LostTech.TensorFlow : API Documentation

Type RegisterGradient

Namespace tensorflow

Parent PythonObjectContainer

Interfaces IRegisterGradient

A decorator for registering the gradient function for an op type.

This decorator is only used when defining a new op type. For an op with `m` inputs and `n` outputs, the gradient function is a function that takes the original `Operation` and `n` `Tensor` objects (representing the gradients with respect to each output of the op), and returns `m` `Tensor` objects (representing the partial gradients with respect to each input of the op).

For example, assuming that operations of type `"Sub"` take two inputs `x` and `y`, and return a single output `x - y`, the following gradient function would be registered: The decorator argument `op_type` is the string type of an operation. This corresponds to the `OpDef.name` field for the proto that defines the operation.
Show Example
@tf.RegisterGradient("Sub")
            def _sub_grad(unused_op, grad):
              return grad, tf.negative(grad) 

Methods

Properties

Public instance methods

PythonFunctionContainer __call__(PythonFunctionContainer f)

Perform the KL registration.
Returns
PythonFunctionContainer
kl_fn

object __call___dyn(object f)

Perform the KL registration.
Returns
object
kl_fn

Public properties

object PythonObject get;