Removes potential crash from GraphMgr.

Change: 144020788
This commit is contained in:
A. Unique TensorFlower 2017-01-09 16:08:04 -08:00 committed by TensorFlower Gardener
parent ee79ebd9bb
commit bfa0fa079d

View File

@ -153,7 +153,12 @@ Status GraphMgr::InitItem(const string& session, const GraphDef& gdef,
// Find the device.
s = worker_env_->device_mgr->LookupDevice(device_name, &unit->device);
if (!s.ok()) break;
if (!s.ok()) {
// Remove the empty unit from the item as the item destructor wants all
// units to have valid devices.
item->units.pop_back();
break;
}
// Construct the subgraph.
Graph* subgraph = new Graph(item->lib_def);