1 /** 2 * Copyright 2020 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_CORE_OPS_ROI_POOLING_H_ 18 #define MINDSPORE_CORE_OPS_ROI_POOLING_H_ 19 #include <map> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "mindapi/base/types.h" 25 #include "ops/base_operator.h" 26 27 namespace mindspore { 28 namespace ops { 29 constexpr auto kNameROIPooling = "ROIPooling"; 30 /// \brief ROIPooling defined the ROIPooling operator prototype. 31 class MIND_API ROIPooling : public BaseOperator { 32 public: 33 MIND_API_BASE_MEMBER(ROIPooling); 34 /// \brief Constructor. ROIPooling()35 ROIPooling() : BaseOperator(kNameROIPooling) {} 36 37 /// \brief Method to init the op's attributes. 38 /// 39 /// \param[in] pooled_h Define the height of the output. 40 /// \param[in] pooled_w Define the width of the output. 41 /// \param[in] scale Define the size factor to translate ROI coordinates from the input coordinate to the actual 42 /// coordinate. 43 void Init(const int64_t pooled_h, const int64_t pooled_w, const float scale); 44 45 /// \brief Method to set pooled_h attribute. 46 /// 47 /// \param[in] pooled_h Define the height of the output. 48 void set_pooled_h(const int64_t pooled_h); 49 50 /// \brief Method to set pooled_w attribute. 51 /// 52 /// \param[in] pooled_w Define the width of the output. 53 void set_pooled_w(const int64_t pooled_w); 54 55 /// \brief Method to set scale attribute. 56 /// 57 /// \param[in] scale Define the size factor to translate ROI coordinates from the input coordinate to the actual 58 /// coordinate. 59 void set_scale(const float scale); 60 61 /// \brief Method to get pooled_h attribute. 62 /// 63 /// \return the height of the output. 64 int64_t get_pooled_h() const; 65 66 /// \brief Method to get pooled_w attribute. 67 /// 68 /// \return the width of the output. 69 int64_t get_pooled_w() const; 70 71 /// \brief Method to get scale attribute. 72 /// 73 /// \return the size factor. 74 float get_scale() const; 75 }; 76 MIND_API abstract::AbstractBasePtr ROIPoolingInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive, 77 const std::vector<abstract::AbstractBasePtr> &input_args); 78 } // namespace ops 79 } // namespace mindspore 80 81 #endif // MINDSPORE_CORE_OPS_ROI_POOLING_H_ 82