• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SPLIT_H_
18 #define MINDSPORE_CORE_OPS_SPLIT_H_
19 #include <vector>
20 #include <memory>
21 
22 #include "ops/primitive_c.h"
23 #include "abstract/abstract_value.h"
24 #include "utils/check_convert_utils.h"
25 
26 namespace mindspore {
27 namespace ops {
28 constexpr auto kNameSplit = "Split";
29 /// \brief Splits the input tensor into output_num of tensors along the given axis and output numbers.
30 /// Refer to Python API @ref mindspore.ops.Split for more details.
31 class MS_CORE_API Split : public PrimitiveC {
32  public:
33   /// \brief Constructor.
Split()34   Split() : PrimitiveC(kNameSplit) {}
35   /// \brief Destructor.
36   ~Split() = default;
37   MS_DECLARE_PARENT(Split, PrimitiveC);
38   /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.Split for the inputs.
39   void Init(const int64_t axis, const int64_t output_num);
40   /// \brief Set size_splits.
41   void set_size_splits(const std::vector<int64_t> &size_splits);
42   /// \brief Set axis.
43   void set_axis(const int64_t axis);
44   /// \brief Set output_num.
45   void set_output_num(const int64_t output_num);
46   /// \brief Get size_splits.
47   ///
48   /// \return size_splits.
49   std::vector<int64_t> get_size_splits() const;
50   /// \brief Get size_splits.
51   ///
52   /// \return size_splits.
53   int64_t get_axis() const;
54   /// \brief Get output_num.
55   ///
56   /// \return output_num.
57   int64_t get_output_num() const;
58 };
59 AbstractBasePtr SplitInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
60                            const std::vector<AbstractBasePtr> &input_args);
61 using PrimSplit = std::shared_ptr<Split>;
62 }  // namespace ops
63 }  // namespace mindspore
64 
65 #endif  // MINDSPORE_CORE_OPS_SPLIT_H_
66