message: [TF] TFShouldUse only enabled when not (in eager mode or building a function).
diff: @@ -23,6 +23,8 @@ import traceback
  import six # pylint: disable=unused-import
  +
  +from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import tf_decorator
  @@ -34,7 +36,8 @@ class _TFShouldUseHelper(object):
  When it is deleted it will emit a warning or error if its `sate` method
  has not been called by time of deletion, and Tensorflow is not executing
  - eagerly outside of functions.
  + eagerly or inside a tf.function (which use autodeps and resolve the
  + main issues this wrapper warns about).
  """
  def __init__(self, type_, repr_, stack_frame, fatal_error_if_unsated):
  @@ -42,7 +45,10 @@ class _TFShouldUseHelper(object):
  self._repr = repr_
  self._stack_frame = stack_frame
  self._fatal_error_if_unsated = fatal_error_if_unsated
  - self._sated = False
  + # If in eager mode or building a function with autodeps, we generally do not
  + # need these warnings since behavior is eager-like.
  + self._sated = (context.executing_eagerly()
  + or ops.get_default_graph()._building_function) # pylint: disable=protected-access
  def sate(self):
  self._sated = True
  @@ -52,8 +58,6 @@ class _TFShouldUseHelper(object):
  self._logging_module = None
  def __del__(self):
  - if ops.executing_eagerly_outside_functions():
  - return
  if self._sated:
  return
  if self._fatal_error_if_unsated:
  