| 1605 | } |
| 1606 | |
| 1607 | tensorflow::Status ConvertGatherOperator( |
| 1608 | const NodeDef& node, const TensorFlowImportFlags& tf_import_flags, |
| 1609 | const ModelFlags& model_flags, Model* model) { |
| 1610 | CHECK(node.op() == "Gather" || node.op() == "GatherV2"); |
| 1611 | if (node.op() == "Gather") |
| 1612 | TF_QCHECK_OK(CheckInputsCount(node, tf_import_flags, 2)); |
| 1613 | if (node.op() == "GatherV2") |
| 1614 | TF_QCHECK_OK(CheckInputsCount(node, tf_import_flags, 3)); |
| 1615 | const auto indices_data_type = GetDataTypeAttr(node, "Tindices"); |
| 1616 | CHECK(indices_data_type == DT_INT32 || indices_data_type == DT_INT64); |
| 1617 | auto* op = new GatherOperator; |
| 1618 | op->inputs.push_back(node.input(0)); |
| 1619 | op->inputs.push_back(node.input(1)); |
| 1620 | if (node.input_size() >= 3) { |
| 1621 | // GatherV2 form where we are provided an axis. It may be either a constant |
| 1622 | // or runtime defined value, so we just wire up the array and let |
| 1623 | // ResolveGatherAttributes take care of it later on. |
| 1624 | const auto axis_data_type = GetDataTypeAttr(node, "Taxis"); |
| 1625 | CHECK(axis_data_type == DT_INT32 || axis_data_type == DT_INT64); |
| 1626 | op->inputs.push_back(node.input(2)); |
| 1627 | } else { |
| 1628 | // Gather form that assumes axis=0. |
| 1629 | op->axis = {0}; |
| 1630 | } |
| 1631 | op->outputs.push_back(node.name()); |
| 1632 | model->operators.emplace_back(op); |
| 1633 | return tensorflow::Status::OK(); |
| 1634 | } |
| 1635 | |
| 1636 | tensorflow::Status ConvertGatherNdOperator( |
| 1637 | const NodeDef& node, const TensorFlowImportFlags& tf_import_flags, |
nothing calls this directly
no test coverage detected