• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020-2021 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_NPU_OP_MAX_POOLING_NPU_H_
18 #define MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_NPU_OP_MAX_POOLING_NPU_H_
19 #include <vector>
20 #include <string>
21 #include "src/delegate/npu/op/convolution_base_npu.h"
22 namespace mindspore {
23 class MaxPoolingNPUOp : public ConvolutionBaseNPUOp {
24  public:
MaxPoolingNPUOp(const schema::Primitive * primitive,const std::vector<mindspore::MSTensor> & in_tensors,const std::vector<mindspore::MSTensor> & out_tensors,std::string name)25   MaxPoolingNPUOp(const schema::Primitive *primitive, const std::vector<mindspore::MSTensor> &in_tensors,
26                   const std::vector<mindspore::MSTensor> &out_tensors, std::string name)
27       : ConvolutionBaseNPUOp(primitive, in_tensors, out_tensors, name) {}
28 
29   ~MaxPoolingNPUOp() override;
30 
31   int IsSupport(const schema::Primitive *primitive, const std::vector<mindspore::MSTensor> &in_tensors,
32                 const std::vector<mindspore::MSTensor> &out_tensors) override;
33 
34   int Init(const schema::Primitive *primitive, const std::vector<mindspore::MSTensor> &in_tensors,
35            const std::vector<mindspore::MSTensor> &out_tensors) override;
36 
37   int SetNPUInputs(const std::vector<mindspore::MSTensor> &in_tensors,
38                    const std::vector<mindspore::MSTensor> &out_tensors,
39                    const std::vector<ge::Operator *> &npu_inputs) override;
40 
41   ge::Operator *GetNPUOp() override;
42 
43  private:
44   int SetPoolingParam(const schema::MaxPoolFusion *pooling_prim);
45   schema::ActivationType act_type_ = schema::ActivationType_NO_ACTIVATION;
46   hiai::op::PoolingD *pooling_ = nullptr;
47 };
48 }  // namespace mindspore
49 #endif  // MINDSPORE_LITE_SRC_RUNTIME_DELEGATE_NPU_OP_MAX_POOLING_NPU_H_
50