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

Method SetProducer

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

Source from the content-addressed store, hash-verified

255 }
256
257 Status SetProducer(NodeId producer, ValueId value) final {
258 ValueDef* v;
259 RETURN_IF_ERROR(LookupValue(value, &v));
260 Value<TensorT>* value_ptr = v->value.get();
261 NodeDef* n;
262 RETURN_IF_ERROR(LookupNode(producer, &n));
263 Node* node_ptr = n->node.get();
264
265 // check if this value has the same producer already
266 if (node_ptr == v->producer) {
267 return InvalidArgumentError("Node is already a producer of the value");
268 }
269
270 // Check if the node is a consumer of this value.
271 if (std::find(n->inputs.begin(), n->inputs.end(), value_ptr) !=
272 n->inputs.end()) {
273 return InvalidArgumentError("Node is a consumer of the value");
274 }
275 // TODO(akulik): detect circular dependency?
276
277 if (v->producer != nullptr) {
278 // value is no longer produced by it's previous producer.
279 Erase(&nodes_[v->producer->id].outputs, value_ptr);
280 }
281 v->producer = node_ptr;
282 n->outputs.push_back(value_ptr);
283 return OkStatus();
284 }
285
286 Status RemoveProducer(ValueId value) final {
287 ValueDef* v;

Callers 11

SingleOpModelMethod · 0.45
NewPassthroughNodeFunction · 0.45
AddOutputMethod · 0.45
NewConstNodeFunction · 0.45
ParseMethod · 0.45
ParseMethod · 0.45
TESTFunction · 0.45
MakeExactCopyMethod · 0.45
RemoveFollowingNodeFunction · 0.45
AddOutputFunction · 0.45
TESTFunction · 0.45

Calls 6

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

Tested by 3

SingleOpModelMethod · 0.36
TESTFunction · 0.36
TESTFunction · 0.36