Clears the device field of all ops in the graph.
| 28 | |
| 29 | // Clears the device field of all ops in the graph. |
| 30 | Status RemoveDevice(const GraphDef& input_graph_def, |
| 31 | const TransformFuncContext& context, |
| 32 | GraphDef* output_graph_def) { |
| 33 | output_graph_def->Clear(); |
| 34 | for (const NodeDef& node : input_graph_def.node()) { |
| 35 | NodeDef* new_node = output_graph_def->mutable_node()->Add(); |
| 36 | *new_node = node; |
| 37 | new_node->set_device(""); |
| 38 | } |
| 39 | |
| 40 | return Status::OK(); |
| 41 | } |
| 42 | |
| 43 | REGISTER_GRAPH_TRANSFORM("remove_device", RemoveDevice); |
| 44 |