| 856 | } |
| 857 | |
| 858 | void GraphConstructor::RemapNodeDefInputs( |
| 859 | NodeDef* node_def, std::vector<bool>* input_already_exists) { |
| 860 | DCHECK_EQ(input_already_exists->size(), node_def->input_size()); |
| 861 | std::set<TensorId> control_inputs; |
| 862 | std::vector<int> inputs_to_remove; |
| 863 | |
| 864 | for (int i = 0; i < node_def->input_size(); ++i) { |
| 865 | auto iter = opts_.input_map.find(ParseTensorName(node_def->input(i))); |
| 866 | if (iter == opts_.input_map.end()) continue; |
| 867 | used_input_map_keys_.insert(iter->first); |
| 868 | |
| 869 | TensorId new_input = iter->second; |
| 870 | if (new_input.second == Graph::kControlSlot) { |
| 871 | // Check if we've already remapped a different input to new_input, and if |
| 872 | // so remove this input. |
| 873 | if (control_inputs.count(new_input) > 0) { |
| 874 | inputs_to_remove.push_back(i); |
| 875 | continue; |
| 876 | } |
| 877 | control_inputs.insert(new_input); |
| 878 | } |
| 879 | node_def->set_input(i, new_input.ToString()); |
| 880 | (*input_already_exists)[i] = true; |
| 881 | } |
| 882 | if (!inputs_to_remove.empty()) { |
| 883 | RemoveInputs(inputs_to_remove, node_def, input_already_exists); |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | void GraphConstructor::AddControlDependencies( |
| 888 | NodeDef* node_def, std::vector<bool>* input_already_exists) { |
nothing calls this directly
no test coverage detected