1 /** 2 * Copyright 2020-2022 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_STRIDED_SLICE_V2_H_ 18 #define MINDSPORE_CORE_OPS_STRIDED_SLICE_V2_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 kNameStridedSliceV2 = "StridedSliceV2"; 30 31 /// \brief Extracts a strided slice of a tensor. Refer to Python API @ref mindspore.ops.StridedSlice for more details. 32 class MIND_API StridedSliceV2 : public BaseOperator { 33 public: 34 MIND_API_BASE_MEMBER(StridedSliceV2); 35 /// \brief Constructor. StridedSliceV2()36 StridedSliceV2() : BaseOperator(kNameStridedSliceV2) { InitIOName({"x", "begin", "end", "strides"}, {"output"}); } 37 /// \brief Init. Refer to the parameters of python API @ref mindspore.ops.StridedSliceV2 for the inputs. 38 void Init(int64_t begin_mask = 0, int64_t end_mask = 0, int64_t ellipsis_mask = 0, int64_t new_axis_mask = 0, 39 int64_t shrink_axis_mask = 0); 40 /// \brief Set begin_mask. 41 void set_begin_mask(int64_t begin_mask); 42 /// \brief Set end_mask. 43 void set_end_mask(int64_t end_mask); 44 /// \brief Set ellipsis_mask. 45 void set_ellipsis_mask(int64_t ellipsis_mask); 46 /// \brief Set new_axis_mask. 47 void set_new_axis_mask(int64_t new_axis_mask); 48 /// \brief Set shrink_axis_mask. 49 void set_shrink_axis_mask(int64_t shrink_axis_mask); 50 /// \brief Get begin_mask. 51 /// 52 /// \return begin_mask. 53 int64_t get_begin_mask() const; 54 /// \brief Get end_mask. 55 /// 56 /// \return end_mask. 57 int64_t get_end_mask() const; 58 /// \brief Get ellipsis_mask. 59 /// 60 /// \return ellipsis_mask. 61 int64_t get_ellipsis_mask() const; 62 /// \brief Get new_axis_mask. 63 /// 64 /// \return new_axis_mask. 65 int64_t get_new_axis_mask() const; 66 /// \brief Get shrink_axis_mask. 67 /// 68 /// \return shrink_axis_mask. 69 int64_t get_shrink_axis_mask() const; 70 }; 71 72 MIND_API abstract::AbstractBasePtr StridedSliceV2Infer(const abstract::AnalysisEnginePtr &, 73 const PrimitivePtr &primitive, 74 const std::vector<abstract::AbstractBasePtr> &input_args); 75 using PrimStridedSliceV2Ptr = std::shared_ptr<StridedSliceV2>; 76 } // namespace ops 77 } // namespace mindspore 78 79 #endif // MINDSPORE_CORE_OPS_STRIDED_SLICE_V2_H_ 80