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

Function ConvertUnpackOperator

tensorflow/lite/toco/import_tensorflow.cc:2028–2046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2026}
2027
2028tensorflow::Status ConvertUnpackOperator(
2029 const NodeDef& node, const TensorFlowImportFlags& tf_import_flags,
2030 const ModelFlags& model_flags, Model* model) {
2031 CHECK_EQ(node.op(), "Unpack");
2032 auto op = absl::make_unique<UnpackOperator>();
2033 const int num_inputs = GetInputsCount(node, tf_import_flags);
2034 QCHECK_EQ(num_inputs, 1);
2035 op->inputs.push_back(node.input(0));
2036 op->num = GetIntAttr(node, "num");
2037 op->axis = HasAttr(node, "axis") ? GetIntAttr(node, "axis") : 0;
2038 op->dtype = ConvertDataType(toco::GetDataTypeAttr(node, "T"));
2039
2040 op->outputs.push_back(node.name()); // Implicit :0.
2041 for (int i = 1; i < op->num; ++i) {
2042 op->outputs.push_back(node.name() + ":" + std::to_string(i));
2043 }
2044 model->operators.emplace_back(std::move(op));
2045 return tensorflow::Status::OK();
2046}
2047
2048// Some TensorFlow ops only occur in graph cycles, representing
2049// control flow. We do not currently support control flow, so we wouldn't

Callers

nothing calls this directly

Calls 11

GetInputsCountFunction · 0.85
GetIntAttrFunction · 0.85
HasAttrFunction · 0.85
GetDataTypeAttrFunction · 0.85
to_stringFunction · 0.85
ConvertDataTypeFunction · 0.70
nameMethod · 0.65
opMethod · 0.45
push_backMethod · 0.45
inputMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected