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

Method AddConsumer

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

Source from the content-addressed store, hash-verified

296 }
297
298 Status AddConsumer(NodeId consumer, ValueId value) final {
299 ValueDef* v;
300 RETURN_IF_ERROR(LookupValue(value, &v));
301 Value<TensorT>* value_ptr = v->value.get();
302 NodeDef* n;
303 RETURN_IF_ERROR(LookupNode(consumer, &n));
304 Node* node_ptr = n->node.get();
305
306 // check if this value has the same producer already
307 if (node_ptr == v->producer) {
308 return InvalidArgumentError("Node is a producer of the value");
309 }
310
311 // check if this value has the same consumer already
312 if (std::find(n->inputs.begin(), n->inputs.end(), value_ptr) !=
313 n->inputs.end()) {
314 return InvalidArgumentError("Node is already a consumer of the value");
315 }
316
317 n->inputs.push_back(value_ptr);
318 v->consumers.push_back(node_ptr);
319 return OkStatus();
320 }
321
322 Status RemoveConsumer(NodeId consumer, ValueId value) final {
323 ValueDef* v;

Callers 15

ApplyToNodeMethod · 0.80
SingleOpModelMethod · 0.80
NewPassthroughNodeFunction · 0.80
AddInputMethod · 0.80
ParseMethod · 0.80
ParseMethod · 0.80
ParseMethod · 0.80
ParseMethod · 0.80
ParseMethod · 0.80
TESTFunction · 0.80
MakeExactCopyMethod · 0.80
RemovePrecedingNodeFunction · 0.80

Calls 6

OkStatusFunction · 0.85
InvalidArgumentErrorFunction · 0.70
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by 9

SingleOpModelMethod · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64
TESTFunction · 0.64