コード例 #1
0
def _handle_graph(handle):
  # Note: might have an eager tensor but not be executing eagerly when building
  # functions.
  if (context.executing_eagerly() or isinstance(handle, ops.EagerTensor)
      or ops.has_default_graph()):
    yield
  else:
    with handle.graph.as_default():
      yield
コード例 #2
0
ファイル: tpu_values.py プロジェクト: Rameezpnr/tensorflow
def _maybe_enter_graph(tensor):
    # Note: might have an eager tensor but not be executing eagerly when
    # building functions.
    if (context.executing_eagerly() or isinstance(tensor, ops.EagerTensor)
            or ops.has_default_graph()):
        yield
    else:
        with tensor.graph.as_default():
            yield
コード例 #3
0
def _handle_graph(handle):
  # Note: might have an eager tensor but not be executing eagerly when building
  # functions.
  if (context.executing_eagerly() or isinstance(handle, ops.EagerTensor)
      or ops.has_default_graph()):
    yield
  else:
    with handle.graph.as_default():
      yield