| 802 | } |
| 803 | |
| 804 | Status CreateRestoreOp(const std::string& name, |
| 805 | std::vector<SrcInfo>& input_info, |
| 806 | std::vector<DataType>& types, |
| 807 | Graph* graph, Node** new_node) { |
| 808 | NodeDef restore_def; |
| 809 | restore_def.set_name(name); |
| 810 | restore_def.set_op("RestoreV2"); |
| 811 | DataTypeVector dtypes; |
| 812 | for (auto t : types) { |
| 813 | dtypes.push_back(t); |
| 814 | } |
| 815 | AttrValue attr_value; |
| 816 | SetAttrValue(dtypes, &attr_value); |
| 817 | (*restore_def.mutable_attr())["dtypes"] = attr_value; |
| 818 | Status status; |
| 819 | *new_node = graph->AddNode(restore_def, &status); |
| 820 | if (!status.ok()) return status; |
| 821 | |
| 822 | // Add input egdes |
| 823 | for (size_t i = 0; i < input_info.size(); ++i) { |
| 824 | graph->AddEdge(input_info[i].src_node, |
| 825 | input_info[i].src_slot, |
| 826 | *new_node, i); |
| 827 | } |
| 828 | |
| 829 | return Status::OK(); |
| 830 | } |
| 831 | |
| 832 | // create 1-D const op, filled by zeros |
| 833 | Status CreateDefaultValueNode(Graph* graph, int dim_size, |
no test coverage detected