| 
									
										
										
										
											2019-04-17 10:49:11 +08:00
										 |  |  | //
 | 
					
						
							|  |  |  | //  MetalPooling.hpp
 | 
					
						
							|  |  |  | //  MNN
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //  Created by MNN on 2019/01/30.
 | 
					
						
							|  |  |  | //  Copyright © 2018, Alibaba Group Holding Limited
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef MetalPooling_hpp
 | 
					
						
							|  |  |  | #define MetalPooling_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 MetalPooling : public Execution { | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     MetalPooling(Backend *backend, const Pool *pooling); | 
					
						
							|  |  |  |     virtual ~MetalPooling() = 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 mGlobal; | 
					
						
							|  |  |  |     PoolType mPoolType; | 
					
						
							|  |  |  |     int mKernelX; | 
					
						
							|  |  |  |     int mKernelY; | 
					
						
							|  |  |  |     int mStrideX; | 
					
						
							|  |  |  |     int mStrideY; | 
					
						
							|  |  |  |     int mPadX; | 
					
						
							|  |  |  |     int mPadY; | 
					
						
							|  |  |  |     id<MTLBuffer> mConstBuffer; | 
					
						
							| 
									
										
										
										
											2020-11-12 17:01:37 +08:00
										 |  |  |     MTLSize mGroup; | 
					
						
							|  |  |  |     MTLSize mLocal; | 
					
						
							|  |  |  |     id<MTLComputePipelineState> mPipeline; | 
					
						
							| 
									
										
										
										
											2019-04-17 10:49:11 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace MNN
 | 
					
						
							|  |  |  | #endif /* MNN_METAL_ENABLED */
 | 
					
						
							|  |  |  | #endif /* MetalPooling_hpp */
 |