2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// CPUDeconvolutionDepthwise.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2018/07/23.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef CPUDeconvolutionDepthwise_hpp
|
|
|
|
#define CPUDeconvolutionDepthwise_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#include "backend/cpu/CPUDeconvolution.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
namespace MNN {
|
2019-06-17 20:10:35 +08:00
|
|
|
class CPUDeconvolutionDepthwiseBasic : public CPUDeconvolutionBasic {
|
2019-04-17 10:49:11 +08:00
|
|
|
public:
|
2019-06-17 20:10:35 +08:00
|
|
|
CPUDeconvolutionDepthwiseBasic(const Tensor *input, const Op *convOp, Backend *b)
|
|
|
|
: CPUDeconvolutionBasic(input, convOp, b) {
|
|
|
|
}
|
|
|
|
virtual ~CPUDeconvolutionDepthwiseBasic() = default;
|
2019-04-17 10:49:11 +08:00
|
|
|
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;
|
|
|
|
|
|
|
|
private:
|
2021-04-08 15:34:23 +08:00
|
|
|
std::function<void(const uint8_t*, uint8_t*, int)> mFunction;
|
2019-04-17 10:49:11 +08:00
|
|
|
};
|
2019-06-17 20:10:35 +08:00
|
|
|
|
|
|
|
class CPUDeconvolutionDepthwiseMultiInput : public CPUDeconvolutionDepthwiseBasic {
|
|
|
|
public:
|
|
|
|
CPUDeconvolutionDepthwiseMultiInput(const Tensor *input, const Op *convOp, Backend *b)
|
|
|
|
: CPUDeconvolutionDepthwiseBasic(input, convOp, b) {
|
|
|
|
}
|
|
|
|
virtual ~CPUDeconvolutionDepthwiseMultiInput() = 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;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Tensor> mWeight;
|
|
|
|
std::shared_ptr<Tensor> mBias;
|
|
|
|
std::vector<Tensor *> mInputs;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CPUDeconvolutionDepthwise : public CPUDeconvolutionCommon {
|
|
|
|
public:
|
|
|
|
CPUDeconvolutionDepthwise(const Tensor *input, const Op *convOp, Backend *b);
|
|
|
|
virtual ~CPUDeconvolutionDepthwise();
|
|
|
|
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override {
|
|
|
|
mInputs = {inputs[0], mWeight.get(), mBias.get()};
|
|
|
|
return mOrigin->onResize(mInputs, outputs);
|
|
|
|
}
|
|
|
|
virtual ErrorCode onExecute(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override {
|
|
|
|
return mOrigin->onExecute(mInputs, outputs);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Tensor> mWeight;
|
|
|
|
std::vector<Tensor *> mInputs;
|
|
|
|
std::unique_ptr<CPUDeconvolutionDepthwiseBasic> mOrigin;
|
|
|
|
};
|
2019-04-17 10:49:11 +08:00
|
|
|
} // namespace MNN
|
|
|
|
|
|
|
|
#endif /* CPUDeconvolutionDepthwise_hpp */
|