// // FlattenTorch.cpp // MNNConverter // // Created by MNN on 2021/05/10. // Copyright © 2018, Alibaba Group Holding Limited // #include #include "torchOpConverter.hpp" DECLARE_OP_CONVERTER(FlattenTorch); MNN::OpType FlattenTorch::opType() { return MNN::OpType_Flatten; } MNN::OpParameter FlattenTorch::type() { return MNN::OpParameter_Flatten; } std::vector FlattenTorch::inputTensorIdx() { return {0}; } void FlattenTorch::run(MNN::OpT* dstOp, const torch::jit::Node* node, TorchScope* scope) { auto param = new MNN::FlattenT; const auto& inputs = node->inputs(); const auto start_dim = inputs[1]; const auto end_dim = inputs[2]; param->axis = getValue(start_dim); param->endAxis = getValue(end_dim); dstOp->main.value = param; } REGISTER_CONVERTER(FlattenTorch, flatten);