diff options
author | Skye Wanderman-Milne <skyewm@google.com> | 2017-03-16 15:05:24 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-03-16 16:32:16 -0700 |
commit | 433c8c89d2daadc7c19bbb3dcabe9d8afcfd03df (patch) | |
tree | f99ff828eabd46812c845363aff42c6ee5008786 /tensorflow/core/graph/graph.cc | |
parent | 57737d10ef277e4ee4f0f89b0e55f02d71c043d6 (diff) |
Replace OpRegistryInterface* with FunctionLibraryDefinition in Graph.
This is a first step towards supporting functions in C++ graph construction, e.g. being able to import GraphDefs with functions.
Change: 150382046
Diffstat (limited to 'tensorflow/core/graph/graph.cc')
-rw-r--r-- | tensorflow/core/graph/graph.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tensorflow/core/graph/graph.cc b/tensorflow/core/graph/graph.cc index 6d9b114e90..65baf4cd85 100644 --- a/tensorflow/core/graph/graph.cc +++ b/tensorflow/core/graph/graph.cc @@ -225,7 +225,7 @@ Node::Properties::~Properties() {} // Graph Graph::Graph(const OpRegistryInterface* ops) - : ops_(ops), arena_(8 << 10 /* 8kB */) { + : ops_(ops, FunctionDefLibrary()), arena_(8 << 10 /* 8kB */) { versions_.set_producer(TF_GRAPH_DEF_VERSION); versions_.set_min_consumer(TF_GRAPH_DEF_VERSION_MIN_CONSUMER); @@ -246,6 +246,12 @@ Graph::Graph(const OpRegistryInterface* ops) AddControlEdge(source, sink); } +Graph::Graph(const FunctionLibraryDefinition& flib_def) + : Graph(flib_def.default_registry()) { + Status s = ops_.AddLibrary(flib_def); + CHECK(s.ok()) << s.error_message(); +} + Graph::~Graph() { // Manually call the destructors for all the Nodes we constructed using // placement new. @@ -263,7 +269,7 @@ Graph::~Graph() { Node* Graph::AddNode(const NodeDef& node_def, Status* status) { const OpDef* op_def; - status->Update(ops_->LookUpOpDef(node_def.op(), &op_def)); + status->Update(ops_.LookUpOpDef(node_def.op(), &op_def)); if (!status->ok()) return nullptr; DataTypeVector inputs; |