import_graph_def: support "absolute" names with the C API enabled.
authorSkye Wanderman-Milne <skyewm@google.com>
Sat, 10 Feb 2018 01:14:30 +0000 (17:14 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Sat, 10 Feb 2018 01:18:33 +0000 (17:18 -0800)
commit5b71a126c4f0733eccefee76b599e0315f052bef
tree488b7b1111f7fcbfd99c3ac2898bf82c203b5847
parent816f59e6ab53c4553b0325b872b7be5ea73da89b
import_graph_def: support "absolute" names with the C API enabled.

Passing a name with a trailing '/' to import_graph_def causes that
name to be used as-is (i.e. it is not appended to the existing name
scope and not de-duped with any existing name scopes. This is in order
to re-use an existing name scope). This didn't work with the C API
enabled because it was set to always have the C API uniquify the
prefix.

The fix is to not uniquify the prefix, since calling name_scope in
import_graph_def already has the logic to uniquify the prefix if
necessary. I'm not sure why I thought we needed the C API to do this
to being with.

In addition, this changes the graph_constructor.cc logic to uniquify
names if the prefix cannot be guaranteed unique (see the new test case
in graph_constructor_test.cc for why/when this is necessary).

PiperOrigin-RevId: 185215326
tensorflow/core/graph/graph_constructor.cc
tensorflow/core/graph/graph_constructor_test.cc
tensorflow/python/framework/importer.py
tensorflow/python/framework/importer_test.py