2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPUInterp.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/07/17.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CPUInterp_hpp
|
|
|
|
#define CPUInterp_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "backend/cpu/CPUResize.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
namespace MNN {
|
|
|
|
|
2019-07-19 17:09:09 +08:00
|
|
|
class CPUInterp : public CPUResizeCommon {
|
2019-04-17 10:49:11 +08:00
|
|
|
public:
|
2020-11-05 16:41:56 +08:00
|
|
|
CPUInterp(Backend *backend, int resizeType,
|
|
|
|
float widthScale = 0.f, float heightScale = 0.f,
|
|
|
|
float widthOffset = 0.f, float heightOffset = 0.f);
|
2019-05-05 20:27:57 +08:00
|
|
|
virtual ~CPUInterp();
|
2019-04-17 10:49:11 +08:00
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
2019-05-05 20:27:57 +08:00
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
|
2019-07-19 17:09:09 +08:00
|
|
|
|
2019-04-17 10:49:11 +08:00
|
|
|
private:
|
2019-05-05 20:27:57 +08:00
|
|
|
Tensor mWidthPosition;
|
|
|
|
Tensor mWidthFactor;
|
|
|
|
Tensor mHeightPosition;
|
|
|
|
Tensor mHeightFactor;
|
|
|
|
Tensor mLineBuffer;
|
2019-04-17 10:49:11 +08:00
|
|
|
float mWidthScale;
|
|
|
|
float mHeightScale;
|
2020-11-05 16:41:56 +08:00
|
|
|
float mWidthOffset;
|
|
|
|
float mHeightOffset;
|
|
|
|
int mResizeType; // 1:near 2: bilinear 3: cubic 4: nearest_round
|
|
|
|
bool mInit = false;
|
2023-06-16 09:42:45 +08:00
|
|
|
std::shared_ptr<Tensor> mInputTemp;
|
|
|
|
std::shared_ptr<Tensor> mOutputTemp;
|
2023-07-05 11:44:25 +08:00
|
|
|
int8_t mInputQuantZero = 0;
|
|
|
|
int8_t mOutputQuantZero = 0;
|
|
|
|
ssize_t mOutputQuantMIn = -127;
|
|
|
|
ssize_t mOutputQuantMax = 127;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* CPUInterp_hpp */
|