Note that it's easy to confuse/conflate "Stack" and "Pack" operators, but they aren't the same thing. tf.stack results in a "Pack" operator. "Stack" operators also exist, but involve manipulating the TF runtime stack, and are not directly related to tf.stack() usage.
| 2004 | // operators also exist, but involve manipulating the TF runtime stack, and are |
| 2005 | // not directly related to tf.stack() usage. |
| 2006 | tensorflow::Status ConvertPackOperator( |
| 2007 | const NodeDef& node, const TensorFlowImportFlags& tf_import_flags, |
| 2008 | const ModelFlags& model_flags, Model* model) { |
| 2009 | CHECK_EQ(node.op(), "Pack"); |
| 2010 | auto op = absl::make_unique<PackOperator>(); |
| 2011 | const int num_inputs = GetInputsCount(node, tf_import_flags); |
| 2012 | QCHECK_GE(num_inputs, 1) |
| 2013 | << node.op() |
| 2014 | << " node expects at least 1 input other than control dependencies: " |
| 2015 | << node.DebugString(); |
| 2016 | CHECK_EQ(num_inputs, GetIntAttr(node, "N")); |
| 2017 | for (int i = 0; i < num_inputs; ++i) { |
| 2018 | op->inputs.push_back(node.input(i)); |
| 2019 | } |
| 2020 | op->values_count = HasAttr(node, "N") ? GetIntAttr(node, "N") : num_inputs; |
| 2021 | op->axis = HasAttr(node, "axis") ? GetIntAttr(node, "axis") : 0; |
| 2022 | op->dtype = ConvertDataType(toco::GetDataTypeAttr(node, "T")); |
| 2023 | op->outputs.push_back(node.name()); |
| 2024 | model->operators.emplace_back(std::move(op)); |
| 2025 | return tensorflow::Status::OK(); |
| 2026 | } |
| 2027 | |
| 2028 | tensorflow::Status ConvertUnpackOperator( |
| 2029 | const NodeDef& node, const TensorFlowImportFlags& tf_import_flags, |
nothing calls this directly
no test coverage detected