Home | History | Annotate | Download | only in op

Lines Matching defs:Scope

24  * <p>A {@code Scope} is a container for common properties applied to TensorFlow Ops. Normal user
25 * code initializes a {@code Scope} and provides it to Operation building classes. For example:
28 * Scope scope = new Scope(graph);
29 * Constant c = Constant.create(scope, 42);
32 * <p>An Operation building class acquires a Scope, and uses it to set properties on the underlying
38 * public static Constant create(Scope scope, ...) {
39 * scope.graph().opBuilder(
40 * "Const", scope.makeOpName("Const"))
48 * <p><b>Scope hierarchy:</b>
50 * <p>A {@code Scope} provides various {@code with()} methods that create a new scope. The new scope
51 * typically has one property changed while other properties are inherited from the parent scope.
56 * Scope root = new Scope(graph);
59 * Scope linear = Scope.withSubScope("linear");
70 * // this scope
74 * <p>Scope objects are <b>not</b> thread-safe.
76 public final class Scope {
79 * Create a new top-level scope.
81 * @param graph The graph instance to be managed by the scope.
83 public Scope(Graph graph) {
87 /** Returns the graph managed by this scope. */
93 * Returns a new scope where added operations will have the provided name prefix.
95 * <p>Ops created with this scope will have {@code name/childScopeName/} as the prefix. The actual
96 * name will be unique in the returned scope. All other properties are inherited from the current
97 * scope.
99 * <p>The child scope name must match the regular expression {@code [A-Za-z0-9.][A-Za-z0-9_.\-]*}
101 * @param childScopeName name for the new child scope
105 public Scope withSubScope(String childScopeName) {
106 return new Scope(graph, nameScope.withSubScope(childScopeName));
110 * Return a new scope that uses the provided name for an op.
112 * <p>Operations created within this scope will have a name of the form {@code
117 * @param opName name for an operator in the returned scope
118 * @return a new Scope that uses opName for operations.
121 public Scope withName(String opName) {
122 return new Scope(graph, nameScope.withName(opName));
130 * <p>This method generates a unique name, appropriate for the name scope controlled by this
134 * scope.graph().opBuilder("Const", scope.makeOpName("Const"))...
139 * create a {@link #withSubScope(String)} scope for the underlying operators to group them under a
143 * public static Stddev create(Scope scope, ...) {
145 * Scope group = scope.withSubScope("stddev");
158 private Scope(Graph graph, NameScope nameScope) {