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_PACK_H_ 18 #define MINDSPORE_CORE_OPS_PACK_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 kNamePack = "Pack"; 34 /// \brief Stacks a list of tensors in specified axis. 35 /// Refer to Python API @ref mindspore.ops.Stack for more details. 36 class MS_CORE_API Pack : public PrimitiveC { 37 public: 38 /// \brief Constructor. Pack()39 Pack() : PrimitiveC(kNamePack) {} 40 /// \brief Destructor. 41 ~Pack() = default; 42 MS_DECLARE_PARENT(Pack, PrimitiveC); 43 /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.Stack for the inputs. 44 void Init(const int64_t &axis = 0); 45 /// \brief Set axis. 46 void set_axis(const int64_t &axis); 47 /// \brief Get axis. 48 /// 49 /// \return axis. 50 int64_t get_axis() const; 51 }; 52 AbstractBasePtr PackInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive, 53 const std::vector<AbstractBasePtr> &input_args); 54 using PrimPackPtr = std::shared_ptr<Pack>; 55 } // namespace ops 56 } // namespace mindspore 57 #endif // MINDSPORE_CORE_OPS_PACK_H_ 58