aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/graph/graph_constructor.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-03-03 14:14:16 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-03 14:26:26 -0800
commitb177e3720721dea593f1f15ba731ab351e87d298 (patch)
tree6a58e524addc6b2518df22fee094b9a712576910 /tensorflow/core/graph/graph_constructor.cc
parent1dc89c1ab1bee51ae40f97994ef81ac3d6b1391c (diff)
Add the graphdef version to InferenceContext and to ShapeRefiner::AddNode.
Use this to allow loading reductions saved with older graphdefs. Change GraphConstructor to not increase the version when importing, but instead take the min of all versions. Change: 149152437
Diffstat (limited to 'tensorflow/core/graph/graph_constructor.cc')
-rw-r--r--tensorflow/core/graph/graph_constructor.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/core/graph/graph_constructor.cc b/tensorflow/core/graph/graph_constructor.cc
index c68ac37fa8..a83cf26723 100644
--- a/tensorflow/core/graph/graph_constructor.cc
+++ b/tensorflow/core/graph/graph_constructor.cc
@@ -745,8 +745,8 @@ Status GraphConstructor::UpdateVersionDef() {
return Status::OK();
}
VersionDef versions = g_->versions();
- // This new graph is being "produced" by the binary invoking ImportGraphDef.
- versions.set_producer(TF_GRAPH_DEF_VERSION);
+ versions.set_producer(
+ std::min(versions.producer(), gdef_->versions().producer()));
versions.set_min_consumer(
std::max(versions.min_consumer(), gdef_->versions().min_consumer()));
if (gdef_->versions().bad_consumers_size() > 0) {
@@ -820,14 +820,14 @@ Status GraphConstructor::MakeEdge(Node* src, int output_index, Node* dst,
Status ConvertGraphDefToGraph(const GraphConstructorOptions& opts,
const GraphDef& gdef, Graph* g) {
- ShapeRefiner refiner(g->op_registry());
+ ShapeRefiner refiner(gdef.versions().producer(), g->op_registry());
return GraphConstructor::Construct(opts, &gdef, g, &refiner, nullptr);
}
Status ImportGraphDef(const ImportGraphDefOptions& opts, const GraphDef& gdef,
Graph* g, ShapeRefiner* refiner,
std::vector<std::pair<Node*, int>>* return_tensors) {
- ShapeRefiner default_refiner(g->op_registry());
+ ShapeRefiner default_refiner(gdef.versions().producer(), g->op_registry());
if (refiner == nullptr) {
refiner = &default_refiner;
}