2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPUSoftmax.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/07/16.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CPUSoftmax_hpp
|
|
|
|
#define CPUSoftmax_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "core/Execution.hpp"
|
2024-06-03 20:09:34 +08:00
|
|
|
#include "core/BufferAllocator.hpp"
|
2024-07-22 19:51:53 +08:00
|
|
|
#include "core/TensorUtils.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
namespace MNN {
|
|
|
|
class CPUSoftmax : public Execution {
|
|
|
|
public:
|
|
|
|
CPUSoftmax(Backend *b, int axis);
|
|
|
|
virtual ~CPUSoftmax() = default;
|
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
2021-06-11 17:17:13 +08:00
|
|
|
static Execution* create(const MNN::Op *op, Backend *backend);
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
private:
|
2024-06-03 20:09:34 +08:00
|
|
|
int _softmaxCommon(const uint8_t* srcData, uint8_t* dstData);
|
2019-07-19 17:09:09 +08:00
|
|
|
|
2019-04-17 10:49:11 +08:00
|
|
|
int mAxis;
|
|
|
|
Tensor mStorage;
|
2019-05-05 20:27:57 +08:00
|
|
|
bool mNeedUnpackC4;
|
2024-06-03 20:09:34 +08:00
|
|
|
MemChunk mTmpInput;
|
|
|
|
MemChunk mTmpOutput;
|
|
|
|
|
|
|
|
int mInside;
|
|
|
|
int mOutside;
|
|
|
|
int mChannel;
|
2024-07-22 19:51:53 +08:00
|
|
|
|
|
|
|
std::shared_ptr<QuantAttr> mInQuantAttr;
|
|
|
|
std::shared_ptr<QuantAttr> mOutQuantAttr;
|
|
|
|
|
|
|
|
int mLowOrInt8;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* CPUSoftmax_hpp */
|