|TensorFlow 1 version||View source on GitHub|
A context manager for use when defining a Python op.
tf.name_scope( name )
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
def my_op(a, b, c, name=None): with tf.name_scope("MyOp") as scope: a = tf.convert_to_tensor(a, name="a") b = tf.convert_to_tensor(b, name="b") c = tf.convert_to_tensor(c, name="c") # Define some computation that uses `a`, `b`, and `c`. return foo_op(..., name=scope)
When executed, the Tensors
c, will have names