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

Method __enter__

tensorflow/python/framework/ops.py:6517–6536  ·  view source on GitHub ↗

Start the scope block. Returns: The scope name. Raises: ValueError: if neither `name` nor `default_name` is provided but `values` are.

(self)

Source from the content-addressed store, hash-verified

6515 return self._name
6516
6517 def __enter__(self):
6518 """Start the scope block.
6519
6520 Returns:
6521 The scope name.
6522
6523 Raises:
6524 ValueError: if neither `name` nor `default_name` is provided
6525 but `values` are.
6526 """
6527 ctx = context.context()
6528 if ctx.executing_eagerly():
6529 scope_name, old_scope_name = enter_eager_name_scope(ctx, self._name)
6530 self._exit_fns.append(
6531 lambda *a: setattr(ctx, "scope_name", old_scope_name))
6532 else:
6533 scope = get_default_graph().name_scope(self._name)
6534 scope_name = scope.__enter__()
6535 self._exit_fns.append(scope.__exit__)
6536 return scope_name
6537
6538 def __exit__(self, type_arg, value_arg, traceback_arg):
6539 exit_fn = self._exit_fns.pop()

Callers

nothing calls this directly

Calls 7

enter_eager_name_scopeFunction · 0.85
get_default_graphFunction · 0.85
executing_eagerlyMethod · 0.80
contextMethod · 0.45
appendMethod · 0.45
name_scopeMethod · 0.45
__enter__Method · 0.45

Tested by

no test coverage detected