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

Function GetOutputNamesFromNodeDef

tensorflow/lite/toco/import_tensorflow.cc:565–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565void GetOutputNamesFromNodeDef(const NodeDef& node,
566 const tensorflow::OpDef& op_def,
567 TensorFlowUnsupportedOperator* op) {
568 int next_output = 0;
569 auto add_output = [&node, &next_output, op]() {
570 if (next_output == 0) {
571 op->outputs.push_back(node.name()); // Implicit :0.
572 } else {
573 op->outputs.push_back(absl::StrCat(node.name(), ":", next_output));
574 }
575 ++next_output;
576 };
577 for (int i = 0; i < op_def.output_arg_size(); ++i) {
578 string multiples = op_def.output_arg(i).number_attr();
579 if (!multiples.empty()) {
580 CHECK(HasAttr(node, multiples)) << "No attr named " << multiples;
581 int num_outputs = GetIntAttr(node, multiples);
582 for (int j = 0; j < num_outputs; ++j) {
583 add_output();
584 }
585 } else {
586 string list = op_def.output_arg(i).type_list_attr();
587 if (!list.empty()) {
588 CHECK(HasAttr(node, list)) << "No attr named " << list;
589 const AttrValue::ListValue& list_value = GetListAttr(node, list);
590 for (int j = 0; j < list_value.type_size(); ++j) {
591 add_output();
592 }
593 } else {
594 add_output();
595 }
596 }
597 }
598}
599
600void GetOutputTypesFromNodeDef(const NodeDef& node,
601 const tensorflow::OpDef& op_def,

Callers 1

Calls 6

HasAttrFunction · 0.85
GetIntAttrFunction · 0.85
nameMethod · 0.65
StrCatFunction · 0.50
push_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected