aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/graph/graph_constructor.h
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2017-10-04 10:40:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-10-04 10:50:23 -0700
commit9d7843c0a87dba001bf1dae65cf82b794d983d1c (patch)
tree27d687194dc80f16d2e0a3ec824b68bb051e20dd /tensorflow/core/graph/graph_constructor.h
parent4f10a6597c12e7274a433ffdef2c00c6891f4c2b (diff)
Add optional unused_input_map_keys output param to ImportGraphDef
This is a more general feature than that in the Python importer, which raises an exception if the input map contains unused names. PiperOrigin-RevId: 171029316
Diffstat (limited to 'tensorflow/core/graph/graph_constructor.h')
-rw-r--r--tensorflow/core/graph/graph_constructor.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/tensorflow/core/graph/graph_constructor.h b/tensorflow/core/graph/graph_constructor.h
index ae376ba2b9..a8f9f2b245 100644
--- a/tensorflow/core/graph/graph_constructor.h
+++ b/tensorflow/core/graph/graph_constructor.h
@@ -52,17 +52,7 @@ extern Status ConvertGraphDefToGraph(const GraphConstructorOptions& opts,
extern Status ConvertNodeDefsToGraph(const GraphConstructorOptions& opts,
gtl::ArraySlice<NodeDef> nodes, Graph* g);
-// Add the graph in GraphDef gdef into an existing Graph *g.
-//
-// On error, returns non-OK and leaves *g unmodified.
-//
-// "shape_refiner" can be null. It should be non-null if the caller
-// intends to add additional nodes to the graph after the import. This
-// allows the caller to validate shapes of those nodes (since
-// ShapeRefiner::AddNode must be called in topological order).
-//
-// TODO(ashankar): Push this mechanism and get rid of Session::Extend()
-// as a means of enhancing an existing Graph.
+// Options for calling ImportGraphDef().
struct ImportGraphDefOptions {
ImportGraphDefOptions() : skip_mapped_nodes(false) {}
@@ -116,13 +106,30 @@ struct ImportGraphDefOptions {
// python API.
};
+// Adds the graph in GraphDef `gdef` into an existing Graph `*g`.
+//
+// On error, returns non-OK and leaves `*g` unmodified.
+//
+// `refiner` can be null. It should be non-null if the caller
+// intends to add additional nodes to the graph after the import. This
+// allows the caller to validate shapes of those nodes (since
+// ShapeRefiner::AddNode must be called in topological order).
+//
// Each `return_tensors` entry is the requested node and output index. The index
// is included in case the returned tensor has been remapped according to
// `input_map`.
+//
+// If `unused_input_map_keys` is non-null, it should be empty and will be
+// populated with any keys in `opts.input_map` that aren't used as an input to
+// any node in `gdef`.
+//
+// TODO(ashankar): Push this mechanism and get rid of Session::Extend()
+// as a means of enhancing an existing Graph.
extern Status ImportGraphDef(
const ImportGraphDefOptions& opts, const GraphDef& gdef, Graph* g,
ShapeRefiner* refiner,
- std::vector<std::pair<Node*, int>>* return_tensors = nullptr);
+ std::vector<std::pair<Node*, int>>* return_tensors = nullptr,
+ std::vector<TensorId>* unused_input_map_keys = nullptr);
// Make a copy of "src" into "*dest".
//