MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _disallow_bool_casting

Method _disallow_bool_casting

tensorflow/python/framework/ops.py:525–534  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

523 " this function with @tf.function.".format(task))
524
525 def _disallow_bool_casting(self):
526 if ag_ctx.control_status_ctx().status == ag_ctx.Status.DISABLED:
527 self._disallow_when_autograph_disabled(
528 "using a `tf.Tensor` as a Python `bool`")
529 elif ag_ctx.control_status_ctx().status == ag_ctx.Status.ENABLED:
530 self._disallow_when_autograph_enabled(
531 "using a `tf.Tensor` as a Python `bool`")
532 else:
533 # Default: V1-style Graph execution.
534 self._disallow_in_graph_mode("using a `tf.Tensor` as a Python `bool`")
535
536 def _disallow_iteration(self):
537 if ag_ctx.control_status_ctx().status == ag_ctx.Status.DISABLED:

Callers 2

__bool__Method · 0.95
__nonzero__Method · 0.95

Tested by

no test coverage detected