Start the scope block. Returns: The scope name. Raises: ValueError: if neither `name` nor `default_name` is provided but `values` are.
(self)
| 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() |
nothing calls this directly
no test coverage detected