C API: fix device + colocation edge case in import_graph_def
authorSkye Wanderman-Milne <skyewm@google.com>
Wed, 21 Mar 2018 04:30:02 +0000 (21:30 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 21 Mar 2018 04:32:37 +0000 (21:32 -0700)
commitbf741007d1f6f440a2671b9fa8894af3df10ed44
tree812ed57baf38542c3d887271d4ecce8d5da1895b
parentaab6d07a0df3326ce416c331ff951a77fe802a8e
C API: fix device + colocation edge case in import_graph_def

This change makes the C API consistent with the Python API, by making
sure that all nodes in a colocation group have the device of the op
named in the "_class" attr (all other ops' devices are ignored). This
is currently done by preserving the current Python logic for
colocation and devices, which only works if all ops start with no
device set. Without this change, imported nodes would have the device
specified in the GraphDef. This change unsets any device before
running the Python logic.

PiperOrigin-RevId: 189859688
tensorflow/python/framework/importer.py
tensorflow/python/framework/importer_test.py