// // MetalConvolutionDepthwise.hpp // MNN // // Created by MNN on 2019/02/25. // Copyright © 2018, Alibaba Group Holding Limited // #ifndef MetalConvolutionDepthwise_hpp #define MetalConvolutionDepthwise_hpp #import "MetalConvolutionCommon.hpp" #if MNN_METAL_ENABLED namespace MNN { class MetalConvolutionDepthwise : public MetalConvolutionCommon { public: MetalConvolutionDepthwise(Backend *backend, const MNN::Op *op); MetalConvolutionDepthwise(Backend *backend, const MNN::Op *op, bool dynamicWeight); MetalConvolutionDepthwise(Backend *backend, const MNN::Op *op, std::shared_ptr weight, std::shared_ptr bias); virtual ~MetalConvolutionDepthwise() = default; virtual ErrorCode onResize(const std::vector &inputs, const std::vector &outputs) override; virtual bool onClone(Backend* bn, const Op* op, Execution** dst) override; protected: virtual void onEncode(const std::vector &inputs, const std::vector &outputs, id encoder) override; virtual std::shared_ptr weightTransform(int group, int oc, int ic, int kh, int kw, const float *src, bool int8Weight=false, bool int4Weight=false, id srcGpuBuffer=nil, int subBits=0) override; private: bool mDynamicWeight = false; id mWeightTransformPipeline = nil; id mBiasTransformPipeline = nil; id mWeightTransformConstBuffer = nil; id mBiasTransformConstBuffer = nil; std::pair mWeightTransformThreads; std::pair mBiasTransformThreads; id mPipeline; std::pair mThreads; }; } // namespace MNN #endif /* MNN_METAL_ENABLED */ #endif /* MetalConvolutionDepthwise_hpp */