tensorflow::Scope

tensorflow::Scope

#include <scope.h>

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

Summary

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.

A simple example:

using namespace ops;
Scope root = Scope::NewRootScope();
auto c1 = Const(root, { {1, 1} });
auto m = MatMul(root, c1, { {41}, {1} });
GraphDef gdef;
Status s = root.ToGraphDef(&gdef);
if (!s.ok()) { ... }

Scope hierarchy:

The Scope class pr