• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2023 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_GET_TUPLE_INDEX_INFO_H_
18 #define MINDSPORE_CORE_OPS_GET_TUPLE_INDEX_INFO_H_
19 
20 #include <vector>
21 #include <string>
22 #include "ops/base_operator.h"
23 #include "utils/check_convert_utils.h"
24 
25 namespace mindspore {
26 namespace ops {
27 constexpr auto kNameGetTupleIndexInfo = "GetTupleIndexInfo";
28 /// \brief Get tuple index info. Refer to generate_index_info_from_tuple_of_mixed_tensors in _constexpr_utils.py.
29 // inputs: data, fancy_index_position, tensor0, tensor1 ..., tensor7
30 // attrs: kTupleIndexTypes
31 // outputs: broadcast_shape, final_shape, index_tensor_new_shape, fancy_index_position,
32 // slice_shape0 ..., slice_shape7
33 class MIND_API GetTupleIndexInfo : public BaseOperator {
34  public:
35   MIND_API_BASE_MEMBER(GetTupleIndexInfo);
36   /// \brief Constructor.
GetTupleIndexInfo()37   GetTupleIndexInfo() : BaseOperator(kNameGetTupleIndexInfo) {}
38   /// \brief Init function.
Init()39   void Init() const {}
40   static std::vector<ShapeVector> ConstGetTupleIndexInfo(const ShapeVector &data_shape,
41                                                          const std::vector<ShapeVector> &tensor_shapes,
42                                                          const std::vector<int64_t> &tuple_index_types,
43                                                          ShapeVector *broadcast_shape, ShapeVector *final_shape,
44                                                          ShapeVector *index_tensor_new_shape, size_t *fancy_position,
45                                                          const string &tuple_index_info_type);
46 };
47 }  // namespace ops
48 }  // namespace mindspore
49 
50 #endif  // MINDSPORE_CORE_OPS_GET_TUPLE_INDEX_INFO_H_
51