1 /** 2 * Copyright 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_CORE_OPS_SPLIT_WITH_OVERLAP_H_ 18 #define MINDSPORE_CORE_OPS_SPLIT_WITH_OVERLAP_H_ 19 #include <memory> 20 #include <vector> 21 #include "ops/base_operator.h" 22 23 namespace mindspore { 24 namespace ops { 25 constexpr auto kNameSplitWithOverlap = "SplitWithOverlap"; 26 /// \brief All defined All operator prototype of lite. 27 class MIND_API SplitWithOverlap : public BaseOperator { 28 public: 29 MIND_API_BASE_MEMBER(SplitWithOverlap); 30 /// \brief Constructor. SplitWithOverlap()31 SplitWithOverlap() : BaseOperator(kNameSplitWithOverlap) {} 32 33 /// \brief Method to init the op's attributes. 34 /// 35 /// \param[in] number_split Define the number split. 36 /// \param[in] ratio Define the ratio. 37 /// \param[in] extend_top Define the extend top. 38 /// \param[in] extend_bottom Define the extend bottom. 39 /// \param[in] split_dim Define the split dim. 40 /// \param[in] stride Define the pad stride. 41 /// \param[in] pad_top Define the pad top. 42 /// \param[in] trans_format Define the trans format. 43 void Init(int64_t number_split, const std::vector<int64_t> &ratio, const std::vector<int64_t> &extend_top, 44 const std::vector<int64_t> &extend_bottom, int64_t split_dim, int64_t stride, int64_t pad_top, 45 bool trans_format); 46 47 /// \brief Method to set ratio attributes. 48 /// 49 /// \param[in] ratio Define the ratio. 50 void set_ratio(const std::vector<int64_t> &ratio); 51 52 /// \brief Method to set extend_top attributes. 53 /// 54 /// \param[in] extend_top Define the extend top. 55 void set_extend_top(const std::vector<int64_t> &extend_top); 56 57 /// \brief Method to set extend_bottom attributes. 58 /// 59 /// \param[in] extend_bottom Define the extend bottom. 60 void set_extend_bottom(const std::vector<int64_t> &extend_bottom); 61 62 /// \brief Method to set number_split attributes. 63 /// 64 /// \param[in] number_split Define the number split. 65 void set_number_split(int64_t number_split); 66 67 /// \brief Method to set split_dim attributes. 68 /// 69 /// \param[in] split_dim Define the split dim. 70 void set_split_dim(int64_t split_dim); 71 72 /// \brief Method to set stride attributes. 73 /// 74 /// \param[in] stride Define the stride. 75 void set_split_stride(int64_t stride); 76 77 /// \brief Method to set pad_top attributes. 78 /// 79 /// \param[in] pad_top Define the pad top. 80 void set_pad_top(int64_t pad_top); 81 82 /// \brief Method to set trans_format attributes. 83 /// 84 /// \param[in] trans_format Define the trans format. 85 void set_trans_format(bool trans_format); 86 87 /// \brief Method to get ratio attributes. 88 /// 89 /// \return ratio attributes. 90 std::vector<int64_t> get_ratio() const; 91 92 /// \brief Method to get extend_top attributes. 93 /// 94 /// \return extend_top attributes. 95 std::vector<int64_t> get_extend_top() const; 96 97 /// \brief Method to get extend_bottom attributes. 98 /// 99 /// \return extend_bottom attributes. 100 std::vector<int64_t> get_extend_bottom() const; 101 102 /// \brief Method to get number_split attributes. 103 /// 104 /// \return number_split attributes. 105 int64_t get_number_split() const; 106 107 /// \brief Method to get split_dim attributes. 108 /// 109 /// \return split_dim attributes. 110 int64_t get_split_dim() const; 111 112 /// \brief Method to get split_stride attributes. 113 /// 114 /// \return split_stride attributes. 115 int64_t get_split_stride() const; 116 117 /// \brief Method to get pad_top attributes. 118 /// 119 /// \return pad_top attributes. 120 int64_t get_pad_top() const; 121 122 /// \brief Method to get trans_format attributes. 123 /// 124 /// \return trans_format attributes. 125 bool get_trans_format() const; 126 }; 127 } // namespace ops 128 } // namespace mindspore 129 #endif // MINDSPORE_CORE_OPS_SPLIT_WITH_OVERLAP_H_ 130