W3cubDocs

/TensorFlow Python

tf.NoGradient(op_type)

tf.NoGradient(op_type)

tf.NotDifferentiable(op_type)

See the guide: Building Graphs > Defining new operations

Specifies that ops of type op_type is not differentiable.

This function should not be used for operations that have a well-defined gradient that is not yet implemented.

This function is only used when defining a new op type. It may be used for ops such as tf.size() that are not differentiable. For example:

tf.NotDifferentiable("Size")

The gradient computed for 'op_type' will then propagate zeros.

For ops that have a well-defined gradient but are not yet implemented, no declaration should be made, and an error must be thrown if an attempt to request its gradient is made.

Args:

  • op_type: The string type of an operation. This corresponds to the OpDef.name field for the proto that defines the operation.

Raises:

  • TypeError: If op_type is not a string.

Defined in tensorflow/python/framework/ops.py.

© 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/NoGradient