MNN/source/backend/metal/MetalGridSample.hpp

39 lines
1.0 KiB
C++
Raw Normal View History

2021-04-08 15:34:23 +08:00
//
// MetalGridSample.hpp
// MNN
//
// Created by MNN on 2021/03/24.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef MetalGridSample_hpp
#define MetalGridSample_hpp
2023-12-27 17:26:44 +08:00
#import "MetalExecution.hpp"
2021-04-08 15:34:23 +08:00
#import "MNN_generated.h"
#import "MetalBackend.hpp"
#if MNN_METAL_ENABLED
namespace MNN {
2023-12-27 17:26:44 +08:00
class MetalGridSample : public MetalExecution {
2021-04-08 15:34:23 +08:00
public:
MetalGridSample(Backend *backend, const GridSample* gridSample);
virtual ~MetalGridSample() = default;
2023-12-27 17:26:44 +08:00
virtual void onEncode(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs, id<MTLComputeCommandEncoder> encoder) override;
2021-04-08 15:34:23 +08:00
virtual ErrorCode onResize(const std::vector<Tensor *> &inputs, const std::vector<Tensor *> &outputs) override;
private:
id<MTLBuffer> mParams;
id<MTLComputePipelineState> mPipeline;
std::pair<MTLSize, MTLSize> mThreads;
SampleMode mMode;
BorderMode mPaddingMode;
bool mAlignCorners;
};
} // namespace MNN
#endif /* MNN_METAL_ENABLED */
#endif /* MetalGridSample_hpp */