MNN/source/backend/cpu/CPUUnary.hpp

37 lines
1.1 KiB
C++
Raw Normal View History

2019-04-17 10:49:11 +08:00
//
// CPUUnary.hpp
// MNN
//
// Created by MNN on 2018/08/02.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef CPUUnary_hpp
#define CPUUnary_hpp
2019-12-27 22:16:57 +08:00
#include "core/Execution.hpp"
#include "compute/CommonOptFunction.h"
2019-04-17 10:49:11 +08:00
namespace MNN {
class CPUUnary : public Execution {
public:
2023-10-18 10:31:02 +08:00
CPUUnary(Backend *b, MNNUnaryExecute proc, MNNUnaryExecuteInt8 procInt8, const Op* op);
2019-04-17 10:49:11 +08:00
virtual ~CPUUnary() = 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;
static MNNUnaryExecute selectForFloat(int type, int precision);
2023-10-18 10:31:02 +08:00
static MNNUnaryExecuteInt8 selectForInt8(int type);
2019-04-17 10:49:11 +08:00
protected:
MNNUnaryExecute mProc;
2023-10-18 10:31:02 +08:00
MNNUnaryExecuteInt8 mProcInt8;
std::vector<float> mInpScale;
std::vector<float> mOupScale;
std::vector<ssize_t> mInpZeroPoint;
std::vector<ssize_t> mOupZeroPoint;
std::vector<ssize_t> mMaxMinValue;
std::vector<int8_t> mTableBuffer;
2019-04-17 10:49:11 +08:00
};
} // namespace MNN
#endif /* CPUUnary_hpp */