MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / RemapNodeDefInputs

Method RemapNodeDefInputs

tensorflow/core/graph/graph_constructor.cc:858–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856}
857
858void 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
887void GraphConstructor::AddControlDependencies(
888 NodeDef* node_def, std::vector<bool>* input_already_exists) {

Callers

nothing calls this directly

Calls 13

ParseTensorNameFunction · 0.85
RemoveInputsFunction · 0.85
set_inputMethod · 0.80
sizeMethod · 0.45
input_sizeMethod · 0.45
findMethod · 0.45
inputMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
countMethod · 0.45
push_backMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected