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