Skip unknown devices since we can't optimize for them
authorBenoit Steiner <bsteiner@google.com>
Fri, 2 Feb 2018 01:19:32 +0000 (17:19 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Fri, 2 Feb 2018 01:47:34 +0000 (17:47 -0800)
PiperOrigin-RevId: 184220515

tensorflow/core/common_runtime/graph_execution_state.cc

index 3b309e9..33a5d60 100644 (file)
@@ -340,8 +340,11 @@ Status GraphExecutionState::OptimizeGraph(
     std::unordered_map<string, DeviceProperties> device_map;
     Device* cpu_device = nullptr;
     for (const auto& device : device_set_->devices()) {
-      device_map[device->name()] =
-          grappler::GetDeviceInfo(device->parsed_name());
+      DeviceProperties props = grappler::GetDeviceInfo(device->parsed_name());
+      if (props.type() == "UNKNOWN") {
+        continue;
+      }
+      device_map[device->name()] = props;
       if (device->parsed_name().id == 0 &&
           StringPiece(device->parsed_name().type) == "CPU" &&
           device->GetAllocator(AllocatorAttributes()) != nullptr) {