• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_TENSOR_ARRAY_H_
18 #define MINDSPORE_CORE_OPS_TENSOR_ARRAY_H_
19 #include <vector>
20 #include <string>
21 #include "ops/primitive_c.h"
22 
23 namespace mindspore {
24 namespace ops {
25 
26 constexpr auto kNameTensorArray = "TensorArray";
27 
28 /// \brief Assert defined TensorArray operator prototype of lite.
29 class MS_CORE_API TensorArray : public PrimitiveC {
30  public:
31   /// \brief Constructor.
TensorArray()32   TensorArray() : PrimitiveC(kNameTensorArray) { InitIOName({"size"}, {"handle", "flow"}); }
33   /// \brief Destructor.
34   ~TensorArray() = default;
35   MS_DECLARE_PARENT(TensorArray, PrimitiveC);
36   /// \brief Method to init the op's attributes.
37   void Init(bool dynamic_size, bool identical_element_shapes, const std::vector<int> &element_shape, int data_type);
38   /// \brief Method to set dynamic_size attributes.
39   ///
40   /// \param[in] dynamic_size Define the dynamic_size.
41   void set_dynamic_size(bool dynamic_size);
42   /// \brief Method to set identical_element_shapes attributes.
43   ///
44   /// \param[in] identical_element_shapes Define the identical element shapes
45   void set_identical_element_shapes(bool identical_element_shapes);
46   /// \brief Method to set element_shape attributes.
47   ///
48   /// \param[in] element_shape Define the element shape.
49   void set_element_shape(const std::vector<int> &element_shape);
50   /// \brief Method to set data_type attributes.
51   ///
52   /// \param[in] data_type Define the data type.
53   void set_data_type(int data_type);
54   /// \brief Method to get dynamic_size attributes.
55   bool get_dynamic_size() const;
56   /// \brief Method to get element_shapes attributes.
57   bool get_identical_element_shapes() const;
58   /// \brief Method to get element_shape attributes.
59   const std::vector<int> get_element_shape() const;
60   /// \brief Method to get data_type attributes.
61   int get_data_type() const;
62 };
63 }  // namespace ops
64 }  // namespace mindspore
65 
66 #endif  // MINDSPORE_CORE_OPS_TENSOR_ARRAY_H_
67