[][src]Struct tensorflow::Scope

pub struct Scope { /* fields omitted */ }

A Scope object represents a set of related TensorFlow ops that have the same properties such as a common name prefix.

This type currently requires the experimental_training feature.

A Scope object is a container for TensorFlow Op properties. Op constructors get a Scope object as a mandatory first argument and the constructed op acquires the properties in the object.

Scope hierarchy

The Scope class provides various with_* functions that create a new scope. The new scope typically has one property changed while other properties are inherited from the parent scope. new_sub_scope(name) method appends name to the prefix of names for ops created within the scope, and with_op_name() changes the suffix which otherwise defaults to the type of the op.

Scope lifetime

A new scope is created by calling Scope::new_root_scope. This creates some resources that are shared by all the child scopes that inherit from this scope, directly or transitively. For instance, a new scope creates a new Graph object to which operations are added when the new scope or its children are used by an Op constructor.

Methods

impl Scope[src]

pub fn new_root_scope() -> Scope[src]

Return a new scope. This creates a new graph and all operations constructed in this graph should use the returned object as the "root" scope.

pub fn new_sub_scope(&self, name: &str) -> Scope[src]

Return a new scope. Ops created with this scope will have name/child_scope_name as the prefix. The actual name will be unique in the current scope. All other properties are inherited from the current scope. If child_scope_name is empty, the / is elided.

pub fn with_op_name(&self, name: &str) -> Scope[src]

Return a new scope. All ops created within the returned scope will have names of the form scope_name/name[_suffix]

pub fn get_unique_name_for_op(&self, default_name: &str) -> String[src]

Return a unique name, using default_name if an op name has not been specified.

pub fn graph(&self) -> impl Deref<Target = Graph> + '_[src]

Returns the graph being built by the scope.

pub fn graph_mut(&mut self) -> impl DerefMut<Target = Graph> + '_[src]

Returns the graph being built by the scope.

Trait Implementations

impl Debug for Scope[src]

Auto Trait Implementations

impl !Send for Scope

impl !Sync for Scope

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]