A context manager for use when defining a Python op. This context manager pushes a name scope, which will make the name of all operations added within it have a prefix. For example, to define a new Python op called `my_op`: ```python def my_op(a): with tf.name_scope("MyOp") as scope
(name)
| 734 | |
| 735 | @keras_export('keras.backend.name_scope', v1=[]) |
| 736 | def name_scope(name): |
| 737 | """A context manager for use when defining a Python op. |
| 738 | |
| 739 | This context manager pushes a name scope, which will make the name of all |
| 740 | operations added within it have a prefix. |
| 741 | |
| 742 | For example, to define a new Python op called `my_op`: |
| 743 | |
| 744 | ```python |
| 745 | def my_op(a): |
| 746 | with tf.name_scope("MyOp") as scope: |
| 747 | a = tf.convert_to_tensor(a, name="a") |
| 748 | # Define some computation that uses `a`. |
| 749 | return foo_op(..., name=scope) |
| 750 | ``` |
| 751 | |
| 752 | When executed, the Tensor `a` will have the name `MyOp/a`. |
| 753 | |
| 754 | Args: |
| 755 | name: The prefix to use on all names created within the name scope. |
| 756 | |
| 757 | Returns: |
| 758 | Name scope context manager. |
| 759 | """ |
| 760 | return ops.name_scope_v2(name) |
| 761 | |
| 762 | |
| 763 | @keras_export('keras.backend.variable') |
no outgoing calls
no test coverage detected