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_UNPACK_H_ 18 #define MINDSPORE_CORE_OPS_UNPACK_H_ 19 20 #include <map> 21 #include <vector> 22 #include <string> 23 #include <memory> 24 #include <algorithm> 25 #include "ops/op_utils.h" 26 #include "ops/primitive_c.h" 27 #include "abstract/primitive_infer_map.h" 28 #include "abstract/abstract_value.h" 29 #include "utils/check_convert_utils.h" 30 31 namespace mindspore { 32 namespace ops { 33 constexpr auto kNameUnpack = "Unpack"; 34 /// \brief Unstacks tensor in specified axis. Refer to Python API @ref mindspore.ops.Unstack for more details. 35 class MS_CORE_API Unpack : public PrimitiveC { 36 public: 37 /// \brief Constructor. Unpack()38 Unpack() : PrimitiveC(kNameUnpack) {} 39 /// \brief Destructor. 40 ~Unpack() = default; 41 MS_DECLARE_PARENT(Unpack, PrimitiveC); 42 /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.Unstack for the inputs. 43 void Init(const int64_t axis = 0); 44 /// \brief Set axis. 45 void set_axis(const int64_t axis); 46 /// \brief Get axis. 47 /// 48 /// \return axis. 49 int64_t get_axis() const; 50 }; 51 AbstractBasePtr UnpackInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive, 52 const std::vector<AbstractBasePtr> &input_args); 53 using PrimUnpackPtr = std::shared_ptr<Unpack>; 54 } // namespace ops 55 } // namespace mindspore 56 57 #endif // MINDSPORE_CORE_OPS_UNPACK_H_ 58