2019-04-17 10:49:11 +08:00
|
|
|
//
|
|
|
|
// MetalDeconvolution.hpp
|
|
|
|
// MNN
|
|
|
|
//
|
|
|
|
// Created by MNN on 2019/01/30.
|
|
|
|
// Copyright © 2018, Alibaba Group Holding Limited
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef MetalDeconvolution_hpp
|
|
|
|
#define MetalDeconvolution_hpp
|
|
|
|
|
2019-12-27 22:16:57 +08:00
|
|
|
#import "core/Execution.hpp"
|
2019-04-17 10:49:11 +08:00
|
|
|
#import "MNN_generated.h"
|
|
|
|
#import "MetalDefine.h"
|
|
|
|
|
|
|
|
#if MNN_METAL_ENABLED
|
|
|
|
namespace MNN {
|
|
|
|
|
|
|
|
class MetalDeconvolution : public Execution {
|
|
|
|
public:
|
|
|
|
MetalDeconvolution(Backend *backend, const MNN::Op *op);
|
|
|
|
virtual ~MetalDeconvolution() = 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:
|
|
|
|
bool mDepthwise = false;
|
|
|
|
int mGroup = 0;
|
|
|
|
int mKernelX = 0;
|
|
|
|
int mKernelY = 0;
|
|
|
|
PadMode mPadMode = PadMode_CAFFE;
|
|
|
|
int mPadX = 0;
|
|
|
|
int mPadY = 0;
|
|
|
|
int mStrideX = 0;
|
|
|
|
int mStrideY = 0;
|
|
|
|
int mDilateX = 0;
|
|
|
|
int mDilateY = 0;
|
2021-09-18 15:52:30 +08:00
|
|
|
const MNN::Op *mOp = nullptr;
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
id<MTLBuffer> mWeight = nil;
|
|
|
|
id<MTLBuffer> mBias = nil;
|
|
|
|
id<MTLBuffer> mConstBuffer = nil;
|
2020-11-12 19:23:06 +08:00
|
|
|
id<MTLComputePipelineState> mPipeline;
|
|
|
|
std::pair<MTLSize, MTLSize> mThreads;
|
2019-04-17 10:49:11 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace MNN
|
|
|
|
#endif /* MNN_METAL_ENABLED */
|
|
|
|
#endif /* MetalDeconvolution_hpp */
|