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

Function RemoveInputs

tensorflow/core/graph/graph_constructor.cc:837–856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

835}
836
837void RemoveInputs(const std::vector<int>& inputs_to_remove, NodeDef* node_def,
838 std::vector<bool>* input_already_exists) {
839 // Remove 'inputs_to_remove' from 'node_def'
840 NodeDef copy;
841 copy.mutable_input()->Reserve(node_def->input_size() -
842 inputs_to_remove.size());
843 for (int i = 0, j = 0; i < node_def->input_size(); ++i) {
844 if (j < inputs_to_remove.size() && i == inputs_to_remove[j]) {
845 ++j;
846 } else {
847 copy.add_input()->swap(*node_def->mutable_input(i));
848 }
849 }
850 node_def->mutable_input()->Swap(copy.mutable_input());
851 // Remove 'inputs_to_remove' from 'input_already_exists'
852 for (int idx : inputs_to_remove) {
853 input_already_exists->erase(input_already_exists->begin() + idx);
854 }
855 DCHECK_EQ(input_already_exists->size(), node_def->input_size());
856}
857
858void GraphConstructor::RemapNodeDefInputs(
859 NodeDef* node_def, std::vector<bool>* input_already_exists) {

Callers 1

RemapNodeDefInputsMethod · 0.85

Calls 9

ReserveMethod · 0.45
mutable_inputMethod · 0.45
input_sizeMethod · 0.45
sizeMethod · 0.45
swapMethod · 0.45
add_inputMethod · 0.45
SwapMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected