W3cubDocs

/TensorFlow Python

tf.contrib.eager.inf_nan_callback

tf.contrib.eager.inf_nan_callback(
    op_type,
    inputs,
    attrs,
    outputs,
    op_name,
    check_inf=True,
    check_nan=True,
    action=_DEFAULT_CALLBACK_ACTION
)

Defined in tensorflow/python/eager/execution_callbacks.py.

An execution callback that checks for infs and nans in output tensors.

This callback can be used with tfe.add_execute_callback to check for invalid numeric values. E.g.,

tfe.add_execute_callback(tfe.inf_nan_callback)

Args:

  • op_type: Name of the TFE operation type (e.g., MatMul).
  • inputs: The list of input tensors to the operation, currently unused by this callback.
  • attrs: Attributes of the TFE operation, as a tuple of alternating attribute names and attribute values.
  • outputs: The list of output tensors from the operation, checked by this callback for inf and nan values.
  • op_name: Name of the TFE operation. This name is set by client and can be None if it unset.
  • check_inf: (bool) Whether this callback should check for inf values in the output tensor values.
  • check_nan: (bool) Whether this callback should check for nan values in the output tensor values.
  • action: (str) Action to be taken by the callback when inf or nan values are detected. Possible values {"raise", "warn", "print"} "raise": Raise a InfOrNanError. "warn": Log a warning using tf.logging.warn. "print": Print a message to sys.stdout.

Raises:

  • InfOrNanError: iff inf or nan values are seen in any of outputs and action is "raise".
  • ValueError: iff the value of action is invalid.

© 2018 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/contrib/eager/inf_nan_callback