// // Created by alibaba on 2019/9/11. // #include "TRTSoftmax.hpp" #include "TRTBackend.hpp" #include using namespace std; namespace MNN { TRTSoftmax::TRTSoftmax(Backend *b, const Op *op, const std::vector &inputs, const std::vector &outputs) : MNN::TRTCommonExecution(b,op) { int axis = mOp->main_as_Axis()->axis(); mAxis = axis < 0 ? axis + outputs[0]->dimensions(): axis; } std::vector TRTSoftmax::onEncode(const std::vector &xOp) { auto softmax_layer = mTrtBackend->getNetwork()->addSoftMax(*(xOp[0])); softmax_layer->setAxes(1U << mAxis); return {softmax_layer->getOutput(0)}; } TRTCreatorRegister> __softmax_op(OpType_Softmax); } // namespace MNN