tvm
Loading...
Searching...
No Matches
manipulate.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
24#ifndef TVM_RELAX_OP_MANIPULATE_H_
25#define TVM_RELAX_OP_MANIPULATE_H_
26
27#include <tvm/relax/expr.h>
28#include <tvm/tirx/index_map.h>
29
30namespace tvm {
31namespace relax {
32
34struct ConcatAttrs : public AttrsNode {
35 ffi::Optional<int64_t> axis;
36
37 static void RegisterReflection();
39}; // struct ConcatAttrs
40
42struct ExpandDimsAttrs : public AttrsNode {
43 ffi::Array<int64_t> axis;
44
45 static void RegisterReflection();
47}; // struct ExpandDimsAttrs
48
51 explicit LayoutTransformAttrs(tirx::IndexMap value) : index_map(std::move(value)) {}
52 explicit LayoutTransformAttrs(ffi::UnsafeInit) : index_map(ffi::UnsafeInit{}) {}
54 // pad_value is chosen to be of PrimExpr type, as it represents constant TIR POD expression. This
55 // needs to be revisited in case PrimExpr is evolved to represent symbolic expression in future.
56 ffi::Optional<PrimExpr> pad_value;
57
58 static void RegisterReflection();
59 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.LayoutTransformAttrs", LayoutTransformAttrs,
60 AttrsNode);
61}; // struct LayoutTransformAttrs
62
64struct PermuteDimsAttrs : public AttrsNode {
65 ffi::Optional<ffi::Array<int64_t>> axes;
66
67 static void RegisterReflection();
69}; // struct PermuteDimsAttrs
70
72struct SplitAttrs : public AttrsNode {
73 ffi::ObjectRef indices_or_sections;
74 int axis;
75
76 static void RegisterReflection();
78}; // struct SplitAttrs
79
81struct SqueezeAttrs : public AttrsNode {
82 ffi::Optional<ffi::Array<int64_t>> axis;
83
84 static void RegisterReflection();
86}; // struct SqueezeAttrs
87
89struct StackAttrs : public AttrsNode {
90 ffi::Optional<int64_t> axis;
91
92 static void RegisterReflection();
94}; // struct StackAttrs
95
97struct RepeatAttrs : public AttrsNode {
99 ffi::Optional<int64_t> axis;
100
101 static void RegisterReflection();
103}; // struct RepeatAttrs
104
106struct TileAttrs : public AttrsNode {
107 ffi::Array<int64_t> repeats;
108
109 static void RegisterReflection();
111}; // struct TileAttrs
112
114struct FlipAttrs : public AttrsNode {
115 int64_t axis;
116
117 static void RegisterReflection();
119}; // struct FlipAttrs
120
123 int64_t seq_axis;
124 int64_t batch_axis;
125
126 static void RegisterReflection();
127 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ReverseSequenceAttrs", ReverseSequenceAttrs,
128 AttrsNode);
129}; // struct ReverseSequenceAttrs
130
133 int64_t axis;
134
135 static void RegisterReflection();
136 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GatherElementsAttrs", GatherElementsAttrs,
137 AttrsNode);
138}; // struct GatherElementsAttrs
139
141struct GatherNDAttrs : public AttrsNode {
142 int64_t batch_dims;
143
144 static void RegisterReflection();
146}; // struct GatherNDAttrs
147
149struct IndexPutAttrs : public AttrsNode {
151
152 static void RegisterReflection();
154}; // struct IndexPutAttrs
155
157struct MeshgridAttrs : public AttrsNode {
158 ffi::Optional<ffi::String> indexing;
159
160 static void RegisterReflection();
162};
163
166 int64_t axis;
167 ffi::String reduction;
168
169 static void RegisterReflection();
170 TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScatterElementsAttrs", ScatterElementsAttrs,
171 AttrsNode);
172}; // struct ScatterElementsAttrs
173
175struct ScatterNDAttrs : public AttrsNode {
176 ffi::String reduction;
177
178 static void RegisterReflection();
180}; // struct ScatterNDAttrs
181
184 int axis;
185
186 static void RegisterReflection();
188}; // struct SliceScatterAttrs
189
191struct OneHotAttrs : public AttrsNode {
192 int depth;
193 int axis;
194
195 static void RegisterReflection();
197}; // struct OneHotAttrs
198
199} // namespace relax
200} // namespace tvm
201
202#endif // TVM_RELAX_OP_MANIPULATE_H_
Base class of all attribute class.
Definition attrs.h:50
Definition index_map.h:190
Defines a remapping of tensor indices.
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition attr.h:23
Attributes used in concat operators.
Definition manipulate.h:34
static void RegisterReflection()
ffi::Optional< int64_t > axis
Definition manipulate.h:35
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ConcatAttrs", ConcatAttrs, AttrsNode)
Attributes used in expand_dims operators.
Definition manipulate.h:42
static void RegisterReflection()
ffi::Array< int64_t > axis
Definition manipulate.h:43
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ExpandDimsAttrs", ExpandDimsAttrs, AttrsNode)
Attributes used in flip operators.
Definition manipulate.h:114
static void RegisterReflection()
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.FlipAttrs", FlipAttrs, AttrsNode)
int64_t axis
Definition manipulate.h:115
Attributes used in gather_elements operators.
Definition manipulate.h:132
int64_t axis
Definition manipulate.h:133
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GatherElementsAttrs", GatherElementsAttrs, AttrsNode)
Attributes used in gather_nd operators.
Definition manipulate.h:141
int64_t batch_dims
Definition manipulate.h:142
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.GatherNDAttrs", GatherNDAttrs, AttrsNode)
static void RegisterReflection()
Attributes used in index_put operator.
Definition manipulate.h:149
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.IndexPutAttrs", IndexPutAttrs, AttrsNode)
bool accumulate
Definition manipulate.h:150
static void RegisterReflection()
Attributes used in layout_transform operator.
Definition manipulate.h:50
ffi::Optional< PrimExpr > pad_value
Definition manipulate.h:56
tirx::IndexMap index_map
Definition manipulate.h:53
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.LayoutTransformAttrs", LayoutTransformAttrs, AttrsNode)
LayoutTransformAttrs(tirx::IndexMap value)
Definition manipulate.h:51
LayoutTransformAttrs(ffi::UnsafeInit)
Definition manipulate.h:52
Attribute used in meshgrid operator.
Definition manipulate.h:157
ffi::Optional< ffi::String > indexing
Definition manipulate.h:158
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.MeshgridAttrs", MeshgridAttrs, AttrsNode)
static void RegisterReflection()
Attributes used in one_hot operator.
Definition manipulate.h:191
static void RegisterReflection()
int axis
Definition manipulate.h:193
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.OneHotAttrs", OneHotAttrs, AttrsNode)
int depth
Definition manipulate.h:192
Attributes used in permute_dims operator.
Definition manipulate.h:64
static void RegisterReflection()
ffi::Optional< ffi::Array< int64_t > > axes
Definition manipulate.h:65
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.PermuteDimsAttrs", PermuteDimsAttrs, AttrsNode)
Attributes used in repeat operators.
Definition manipulate.h:97
ffi::Optional< int64_t > axis
Definition manipulate.h:99
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.RepeatAttrs", RepeatAttrs, AttrsNode)
int repeats
Definition manipulate.h:98
static void RegisterReflection()
Attributes used in reverse_sequence operators.
Definition manipulate.h:122
int64_t batch_axis
Definition manipulate.h:124
int64_t seq_axis
Definition manipulate.h:123
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ReverseSequenceAttrs", ReverseSequenceAttrs, AttrsNode)
Attributes used in scatter_elements operators.
Definition manipulate.h:165
ffi::String reduction
Definition manipulate.h:167
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScatterElementsAttrs", ScatterElementsAttrs, AttrsNode)
int64_t axis
Definition manipulate.h:166
Attributes used in scatter_nd operators.
Definition manipulate.h:175
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.ScatterNDAttrs", ScatterNDAttrs, AttrsNode)
static void RegisterReflection()
ffi::String reduction
Definition manipulate.h:176
Attributes used in slice_scatter operator.
Definition manipulate.h:183
int axis
Definition manipulate.h:184
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SliceScatterAttrs", SliceScatterAttrs, AttrsNode)
Attributes used in split operator.
Definition manipulate.h:72
static void RegisterReflection()
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SplitAttrs", SplitAttrs, AttrsNode)
ffi::ObjectRef indices_or_sections
Definition manipulate.h:73
int axis
Definition manipulate.h:74
Attributes used in squeeze operators.
Definition manipulate.h:81
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.SqueezeAttrs", SqueezeAttrs, AttrsNode)
static void RegisterReflection()
ffi::Optional< ffi::Array< int64_t > > axis
Definition manipulate.h:82
Attributes used in stack operators.
Definition manipulate.h:89
ffi::Optional< int64_t > axis
Definition manipulate.h:90
static void RegisterReflection()
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.StackAttrs", StackAttrs, AttrsNode)
Attributes used in tile operators.
Definition manipulate.h:106
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("relax.attrs.TileAttrs", TileAttrs, AttrsNode)
static void RegisterReflection()
ffi::Array< int64_t > repeats
Definition manipulate.h:107