![]() |
An execution callback that checks for inf
s and nan
s in output tensors.
tf.contrib.eager.inf_nan_callback(
op_type,
inputs,
attrs,
outputs,
op_name,
check_inf=True,
check_nan=True,
action=tf.contrib.eager.ExecutionCallback.RAISE
)
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
: Thelist
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
: Thelist
of output tensors from the operation, checked by this callback forinf
andnan
values.op_name
: Name of the TFE operation. This name is set by client and can beNone
if it unset.check_inf
: (bool
) Whether this callback should check forinf
values in the output tensor values.check_nan
: (bool
) Whether this callback should check fornan
values in the output tensor values.action
: (ExecutionCallback
) Action to be taken by the callback wheninf
ornan
values are detected.
Raises:
InfOrNanError
: iffinf
ornan
values are seen in any ofoutputs
andaction
is"raise"
.ValueError
: iff the value ofaction
is invalid.