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

Function RemoveFollowingNode

tensorflow/lite/delegates/gpu/common/model.h:504–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502// that are produced by to_keep. to_keep inherits all to_remove inputs.
503template <typename TensorT>
504Status RemoveFollowingNode(Graph<TensorT>* graph, const Node* to_remove,
505 const Node* to_keep) {
506 // Make sure all inputs to to_remove are produced by to_keep.
507 for (auto input : graph->FindInputs(to_remove->id)) {
508 Node* producer = graph->FindProducer(input->id);
509 if (producer->id != to_keep->id) {
510 return InvalidArgumentError("To_remove node has other inputs");
511 }
512 }
513
514 for (auto input : graph->FindInputs(to_remove->id)) {
515 RETURN_IF_ERROR(graph->DeleteValue(input->id));
516 }
517 for (auto output : graph->FindOutputs(to_remove->id)) {
518 RETURN_IF_ERROR(graph->SetProducer(to_keep->id, output->id));
519 }
520 return graph->DeleteNode(to_remove->id);
521}
522
523// Removes to_remove node.
524// Requires that node has one input and one output;

Callers 7

ApplyToNodesSequenceMethod · 0.85
ApplyToNodesSequenceMethod · 0.85
ApplyToNodesSequenceMethod · 0.85
ApplyToNodesSequenceMethod · 0.85
ApplyToNodesSequenceMethod · 0.85
ApplyToNodesSequenceMethod · 0.85

Calls 7

FindInputsMethod · 0.80
FindProducerMethod · 0.80
DeleteValueMethod · 0.80
FindOutputsMethod · 0.80
DeleteNodeMethod · 0.80
InvalidArgumentErrorFunction · 0.70
SetProducerMethod · 0.45

Tested by

no test coverage detected