2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// ConvolutionInt8Executor.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/07/16.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ConvolutionInt8Executor_hpp
|
|
|
|
#define ConvolutionInt8Executor_hpp
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "core/AutoStorage.h"
|
|
|
|
#include "backend/cpu/compute/ConvolutionFloatFactory.h"
|
|
|
|
#include "backend/cpu/compute/ConvolutionIntFactory.hpp"
|
|
|
|
#include "backend/cpu/CPUConvolution.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
namespace MNN {
|
2023-06-16 09:42:45 +08:00
|
|
|
class IdstConvolutionInt8 : public CPUConvolution {
|
2019-04-17 10:49:11 +08:00
|
|
|
public:
|
2023-06-16 09:42:45 +08:00
|
|
|
IdstConvolutionInt8(const Convolution2DCommon *convOp, Backend *b,
|
2020-03-02 22:13:38 +08:00
|
|
|
const ConvolutionCommon::Int8Common *common, const float *bias, size_t biasSize);
|
2023-06-16 09:42:45 +08:00
|
|
|
virtual ~IdstConvolutionInt8();
|
2019-04-17 10:49:11 +08:00
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Tensor> mWeight;
|
|
|
|
AutoStorage<float> mAlpha;
|
|
|
|
AutoStorage<float> mBias;
|
|
|
|
const IDSTQuan *mQuan;
|
|
|
|
Tensor mSrcCopyBuffer;
|
|
|
|
|
|
|
|
Tensor mTempBuffer;
|
2020-11-05 16:41:56 +08:00
|
|
|
ConvolutionCommon::Im2ColParameter mIm2ColParamter;
|
2019-04-17 10:49:11 +08:00
|
|
|
int mSrcCount;
|
|
|
|
float mAMin;
|
|
|
|
float mAMax;
|
|
|
|
float mQuanScale;
|
2021-04-08 15:34:23 +08:00
|
|
|
std::vector<float> mPostParameters;
|
2021-06-11 17:17:13 +08:00
|
|
|
// mFakeBias used by GemmKernel
|
|
|
|
std::shared_ptr<Tensor> mFakeBias;
|
2024-07-22 19:51:53 +08:00
|
|
|
std::shared_ptr<Tensor> mFakeWeightBias;
|
2023-09-04 10:42:11 +08:00
|
|
|
MemChunk mBlitInfo;
|
2023-06-16 09:42:45 +08:00
|
|
|
std::pair<size_t, size_t> mBlitInfoStride;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* ConvolutionInt8Executor_hpp */
|