tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
transform.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_RELAY_ATTRS_TRANSFORM_H_
25 #define TVM_RELAY_ATTRS_TRANSFORM_H_
26 
27 #include <tvm/ir/attrs.h>
28 #include <tvm/relay/base.h>
29 #include <tvm/relay/expr.h>
30 #include <tvm/tir/index_map.h>
31 
32 #include <string>
33 
34 namespace tvm {
35 namespace relay {
36 
38 struct SlidingWindowAttrs : public tvm::AttrsNode<SlidingWindowAttrs> {
39  int axis;
42  TVM_DECLARE_ATTRS(SlidingWindowAttrs, "relay.attrs.SlidingWindowAttrs") {
43  TVM_ATTR_FIELD(axis).describe(
44  "What axis the sliding window begin forming over."
45  "Window will be slid over this axis and all following axes."
46  "The axis value determines the window shape (and thus, the"
47  "number of strides):"
48  "window shape and strides must both be of length"
49  "`data.ndim-axis`.");
50  TVM_ATTR_FIELD(window_shape)
51  .describe(
52  "The window shape to form over the input."
53  "Window shape must be of length `data.ndim-axis`.");
54  TVM_ATTR_FIELD(strides).describe(
55  "How to stride the window along each dimension."
56  "Strides must be of length `data.ndim-axis`.");
57  }
58 }; // struct SlidingWindowAttrs
59 
61 struct CastAttrs : public tvm::AttrsNode<CastAttrs> {
63 
64  TVM_DECLARE_ATTRS(CastAttrs, "relay.attrs.CastAttrs") {
65  TVM_ATTR_FIELD(dtype).describe("Target data type");
66  }
67 }; // struct CastAttrs.
68 
70 struct ExpandDimsAttrs : public tvm::AttrsNode<ExpandDimsAttrs> {
71  int axis;
73 
74  TVM_DECLARE_ATTRS(ExpandDimsAttrs, "relay.attrs.ExpandDimsAttrs") {
75  TVM_ATTR_FIELD(axis).describe(
76  "The axis at which the input array is expanded."
77  "Should lie in range `[-data.ndim - 1, data.ndim]`."
78  "If `axis < 0`, it is the first axis inserted;"
79  "If `axis >= 0`, it is the last axis inserted in Python's negative indexing.");
80  TVM_ATTR_FIELD(num_newaxis)
81  .describe("Number of axes to be inserted. Should be >= 0.")
82  .set_lower_bound(0)
83  .set_default(1);
84  }
85 }; // struct ExpandDimsAttrs
86 
88 struct DynExpandDimsAttrs : public tvm::AttrsNode<DynExpandDimsAttrs> {
90 
91  TVM_DECLARE_ATTRS(DynExpandDimsAttrs, "relay.attrs.DynExpandDimsAttrs") {
92  TVM_ATTR_FIELD(num_newaxis)
93  .describe("Number of axes to be inserted. Should be >= 0.")
94  .set_lower_bound(0)
95  .set_default(1);
96  }
97 }; // struct ExpandDimsAttrs
98 
100 struct ConcatenateAttrs : public tvm::AttrsNode<ConcatenateAttrs> {
101  int axis;
102  TVM_DECLARE_ATTRS(ConcatenateAttrs, "relay.attrs.ConcatenateAttrs") {
103  TVM_ATTR_FIELD(axis)
104  .describe(
105  "The axis at which the input arrays are concatenated."
106  "Should lie in range `[-ndim, ndim)`.")
107  .set_default(0);
108  }
109 }; // struct ConcatenateAttrs
110 
112 struct TransposeAttrs : public tvm::AttrsNode<TransposeAttrs> {
114  TVM_DECLARE_ATTRS(TransposeAttrs, "relay.attrs.TransposeAttrs") {
115  TVM_ATTR_FIELD(axes).describe("The target axes order, reverse order if not specified.");
116  }
117 }; // struct TransposeAttrs
118 
120 struct ReshapeAttrs : public tvm::AttrsNode<ReshapeAttrs> {
122  bool allowzero;
123  TVM_DECLARE_ATTRS(ReshapeAttrs, "relay.attrs.ReshapeAttrs") {
124  TVM_ATTR_FIELD(newshape).describe(
125  "The new shape. Should be compatible with the original shape.");
126  TVM_ATTR_FIELD(allowzero).set_default(0).describe(
127  "Whether to honor the value of zero in newshape.");
128  }
129 }; // struct ReshapeAttrs
130 
132 struct ReshapeLikeAttrs : public tvm::AttrsNode<ReshapeLikeAttrs> {
134  Integer lhs_end; // can be None
136  Integer rhs_end; // can be None
137  TVM_DECLARE_ATTRS(ReshapeLikeAttrs, "relay.attrs.ReshapeLikeAttrs") {
138  TVM_ATTR_FIELD(lhs_begin).set_default(0).describe(
139  "The axis of the input where reshaping should begin.");
140  TVM_ATTR_FIELD(lhs_end)
141  .set_default(NullValue<Integer>())
142  .describe("The axis of the input where reshaping should end, exclusive.");
143  TVM_ATTR_FIELD(rhs_begin).set_default(0).describe(
144  "The axis of the shape_like tensor to begin taking dimensions from.");
145  TVM_ATTR_FIELD(rhs_end)
146  .set_default(NullValue<Integer>())
147  .describe("The axis of the shape_like tensor to end taking dimensions from, exclusive.");
148  }
149 }; // struct ReshapeLikeAttrs
150 
151 struct ScatterElementsAttrs : public tvm::AttrsNode<ScatterElementsAttrs> {
154 
155  TVM_DECLARE_ATTRS(ScatterElementsAttrs, "relay.attrs.ScatterElementsAttrs") {
156  TVM_ATTR_FIELD(axis).set_default(0).describe("The axis over which to select values.");
157  TVM_ATTR_FIELD(reduction).set_default("update").describe(
158  "Reduction mode of the scatter elements, "
159  "either \"update\", \"add\", \"mul\", \"mean\", \"min\" or \"max\".");
160  }
161 };
162 
163 struct ScatterNDAttrs : public tvm::AttrsNode<ScatterNDAttrs> {
165 
166  TVM_DECLARE_ATTRS(ScatterNDAttrs, "relay.attrs.ScatterNDAttrs") {
167  TVM_ATTR_FIELD(mode).set_default("update").describe(
168  "Accumulation mode of the ScatterND, "
169  "either \"update\", \"add\", \"mul\", \"min\" or \"max\".");
170  }
171 };
172 
173 struct GatherAttrs : public tvm::AttrsNode<GatherAttrs> {
175 
176  TVM_DECLARE_ATTRS(GatherAttrs, "relay.attrs.GatherAttrs") {
177  TVM_ATTR_FIELD(axis)
178  .set_default(NullValue<Integer>())
179  .describe("The axis over which to select values.");
180  }
181 };
182 
183 struct GatherNDAttrs : public tvm::AttrsNode<GatherNDAttrs> {
186 
187  TVM_DECLARE_ATTRS(GatherNDAttrs, "relay.attrs.GatherNDAttrs") {
188  TVM_ATTR_FIELD(batch_dims).set_default(Integer(0)).describe("The number of batch dimensions.");
189  TVM_ATTR_FIELD(index_rank)
190  .set_default(NullValue<Integer>())
191  .describe(
192  "The size of an indexing tuple, which is a fixed value. Only needed when the number of "
193  "indexting tuples is dynamic.");
194  }
195 };
196 
197 struct TakeAttrs : public tvm::AttrsNode<TakeAttrs> {
201 
202  TVM_DECLARE_ATTRS(TakeAttrs, "relay.attrs.TakeAttrs") {
203  TVM_ATTR_FIELD(batch_dims)
204  .set_default(0)
205  .describe("The batch_dims over which to select values.");
206  TVM_ATTR_FIELD(axis)
207  .set_default(NullValue<Integer>())
208  .describe("The axis over which to select values.");
209  TVM_ATTR_FIELD(mode).set_default("clip").describe(
210  "Specify how out-of-bound indices will behave."
211  "clip - clip to the range (default)"
212  "wrap - wrap around the indices"
213  "fast - no clip or wrap around (user must make sure indices are in-bound)");
214  }
215 };
216 
218 struct InitOpAttrs : public tvm::AttrsNode<InitOpAttrs> {
221 
222  TVM_DECLARE_ATTRS(InitOpAttrs, "relay.attrs.InitOpAttrs") {
223  TVM_ATTR_FIELD(shape).describe("Target shape.");
224  TVM_ATTR_FIELD(dtype).describe("Target data type.").set_default(NullValue<DataType>());
225  }
226 }; // struct InitOpAttrs
227 
229 struct ArangeAttrs : public tvm::AttrsNode<ArangeAttrs> {
234 
235  TVM_DECLARE_ATTRS(ArangeAttrs, "relay.attrs.ArangeAttrs") {
236  TVM_ATTR_FIELD(start).describe("Start of interval. The interval includes this value.");
237  TVM_ATTR_FIELD(stop).describe("Stop of interval. The interval does not include this value.");
238  TVM_ATTR_FIELD(step).describe("Spacing between values.");
239  TVM_ATTR_FIELD(dtype).describe("Target data type.");
240  }
241 }; // struct ArangeAttrs
242 
244 struct MeshgridAttrs : public tvm::AttrsNode<MeshgridAttrs> {
245  std::string indexing;
246 
247  TVM_DECLARE_ATTRS(MeshgridAttrs, "relay.attrs.MeshgridAttrs") {
248  TVM_ATTR_FIELD(indexing)
249  .describe(
250  "Indexing mode, either \"ij\" for matrix or \"xy\" for cartesian in which first two"
251  "dimensions are swapped.")
252  .set_default("ij");
253  }
254 }; // struct MeshgridAttrs
255 
257 struct StackAttrs : public tvm::AttrsNode<StackAttrs> {
259  TVM_DECLARE_ATTRS(StackAttrs, "relay.attrs.StackAttrs") {
260  TVM_ATTR_FIELD(axis).set_default(0).describe(
261  "The axis in the result array along which the input arrays are stacked.");
262  }
263 }; // struct StackAttrs
264 
266 struct RepeatAttrs : public tvm::AttrsNode<RepeatAttrs> {
269  TVM_DECLARE_ATTRS(RepeatAttrs, "relay.attrs.RepeatAttrs") {
270  TVM_ATTR_FIELD(repeats).describe("The number of repetitions for each element.");
271  TVM_ATTR_FIELD(axis)
272  .set_default(NullValue<Integer>())
273  .describe(" The axis along which to repeat values.");
274  }
275 }; // struct RepeatAttrs
276 
278 struct TileAttrs : public tvm::AttrsNode<TileAttrs> {
280  TVM_DECLARE_ATTRS(TileAttrs, "relay.attrs.TileAttrs") {
281  TVM_ATTR_FIELD(reps).describe(
282  "The number of times for repeating the tensor a."
283  "Each dim sizeof reps must be a positive integer.");
284  }
285 }; // struct TileAttrs
286 
288 struct ReverseAttrs : public tvm::AttrsNode<ReverseAttrs> {
290  TVM_DECLARE_ATTRS(ReverseAttrs, "relay.attrs.ReverseAttrs") {
291  TVM_ATTR_FIELD(axis)
292  .set_default(NullValue<Integer>())
293  .describe("The axis along which to reverse elements.");
294  }
295 }; // struct ReverseAttrs
296 
298 struct ReverseSequenceAttrs : public tvm::AttrsNode<ReverseSequenceAttrs> {
301 
302  TVM_DECLARE_ATTRS(ReverseSequenceAttrs, "relay.attrs.ReverseSequenceAttrs") {
303  TVM_ATTR_FIELD(seq_axis).set_default(1).describe(
304  "The seq axis along which to reverse elements.");
305  TVM_ATTR_FIELD(batch_axis)
306  .set_default(0)
307  .describe("The batch axis along which to slice the tensor.");
308  }
309 }; // struct ReverseSequenceAttrs
310 
312 struct SqueezeAttrs : public tvm::AttrsNode<SqueezeAttrs> {
313  // use axis to make the name numpy compatible.
315 
316  TVM_DECLARE_ATTRS(SqueezeAttrs, "relay.attrs.SqueezeAttrs") {
317  TVM_ATTR_FIELD(axis)
318  .describe(
319  "The axis to squeeze in the input tensor."
320  "If `axis = None`, all axis of dimension 1 get squeezed;"
321  "Else, the dimension in axes get squeezed."
322  "It is an error if an axis does not has dimension 1.")
323  .set_default(NullValue<Array<Integer>>());
324  }
325 }; // struct SqueezeAttrs
326 
327 struct SplitAttrs : public tvm::AttrsNode<SplitAttrs> {
329  int axis;
330 
331  TVM_DECLARE_ATTRS(SplitAttrs, "relay.attrs.SplitAttrs") {
332  TVM_ATTR_FIELD(indices_or_sections)
333  .describe(
334  "Indices or sections to split into. Accepts an int or a tuple"
335  "If indices_or_sections is an integer, the input will be divided equally"
336  "along given axis. If such a split is not possible, an error is raised."
337  "If indices_or_sections is a tuple of sorted integers,"
338  "the entries indicate where along axis the array is split.");
339  TVM_ATTR_FIELD(axis).set_default(0).describe("the axis to be splitted.");
340  }
341 };
342 
344 struct StridedSliceAttrs : public tvm::AttrsNode<StridedSliceAttrs> {
350 
351  TVM_DECLARE_ATTRS(StridedSliceAttrs, "relay.attrs.StridedSliceAttrs") {
352  TVM_ATTR_FIELD(begin).describe("Indices for begin of slice, begin index is also inclusive");
353  TVM_ATTR_FIELD(end).describe("Indices for end of slice, end index is exclusive");
354  TVM_ATTR_FIELD(strides).describe(
355  "Stride values of the slice, a stride can be negative, which causes a reverse slice.");
356  TVM_ATTR_FIELD(slice_mode)
357  .set_default("end")
358  .describe(
359  "The slice mode [end, size]."
360  "end - The default slice mode, ending indices for the slice."
361  "size - The input strides will be ignored, input end in this mode indicates the size"
362  "of a slice starting at the location specified by begin. If end[i] is -1,"
363  "all remaining elements in that dimension are included in the slice");
364  TVM_ATTR_FIELD(axes).describe(
365  "Axes along which slicing is applied. When it is specified, the length of begin, end, "
366  "strides, and axes must be equal.");
367  }
368 };
369 
370 struct SliceLikeAttrs : public tvm::AttrsNode<SliceLikeAttrs> {
372 
373  TVM_DECLARE_ATTRS(SliceLikeAttrs, "relay.attrs.SliceLikeAttrs") {
374  TVM_ATTR_FIELD(axes).describe(
375  "List of axes on which input data will be sliced according to the "
376  "corresponding size of the second input. By default will slice "
377  "on all axes. Negative axes mean counting in reverse.");
378  }
379 };
380 
382 struct ClipAttrs : public tvm::AttrsNode<ClipAttrs> {
383  double a_min;
384  double a_max;
385 
386  TVM_DECLARE_ATTRS(ClipAttrs, "relay.attrs.ClipAttrs") {
387  TVM_ATTR_FIELD(a_min).describe("The minimum clip value.");
388  TVM_ATTR_FIELD(a_max).describe("The maximum clip value.");
389  }
390 };
391 
393 struct FixedPointMultiplyAttrs : public tvm::AttrsNode<FixedPointMultiplyAttrs> {
394  int32_t multiplier;
395  int32_t shift;
396 
397  TVM_DECLARE_ATTRS(FixedPointMultiplyAttrs, "relay.attrs.FixedPointMultiplyAttrs") {
398  TVM_ATTR_FIELD(multiplier)
399  .describe("Multiplier of a fixed floating point number described as multiplier*2^(shift)");
400  TVM_ATTR_FIELD(shift).describe(
401  "Shift of a fixed floating point number described as multiplier*2^(shift)");
402  }
403 };
404 
406 struct FixedPointMultiplyPerAxisAttrs : public tvm::AttrsNode<FixedPointMultiplyPerAxisAttrs> {
410 
411  TVM_DECLARE_ATTRS(FixedPointMultiplyPerAxisAttrs, "relay.attrs.FixedPointMultiplyPerAxisAttrs") {
412  TVM_ATTR_FIELD(is_lshift_required)
413  .describe("Whether left shift is required in fixed point multiplication.")
414  .set_default(false);
415  TVM_ATTR_FIELD(is_rshift_required)
416  .describe("Whether right shift is required in fixed point multiplication.")
417  .set_default(false);
418  TVM_ATTR_FIELD(axes).describe("List of axes on which input data was quantized.");
419  }
420 };
421 
423 struct LayoutTransformAttrs : public tvm::AttrsNode<LayoutTransformAttrs> {
424  std::string src_layout;
425  std::string dst_layout;
426 
427  TVM_DECLARE_ATTRS(LayoutTransformAttrs, "relay.attrs.LayoutTransformAttrs") {
428  TVM_ATTR_FIELD(src_layout).describe("The source layout of the tensor. (e.g. NCHW)");
429  TVM_ATTR_FIELD(dst_layout).describe("The destination layout of the tensor. (e.g. NCHW16c)");
430  }
431 };
432 
435  : public tvm::AttrsNode<AutoSchedulerLayoutTransformAttrs> {
436  std::string src_layout;
437  std::string dst_layout;
438 
440  "relay.attrs.AutoSchedulerLayoutTransformAttrs") {
441  TVM_ATTR_FIELD(src_layout).describe("The source layout of the tensor. (e.g. 1N32C112H112W)");
442  TVM_ATTR_FIELD(dst_layout)
443  .describe("The destination layout of the tensor. (e.g. 1N2C112H112W16c)");
444  }
445 };
446 
448 struct MetaScheduleLayoutTransformAttrs : public tvm::AttrsNode<MetaScheduleLayoutTransformAttrs> {
450 
452  "relay.attrs.MetaScheduleLayoutTransformAttrs") {
453  TVM_ATTR_FIELD(index_map).describe(
454  "The order of the extents, for example, "
455  "let extents = [2, 3, 4], reorder = [0, 2, 1], and the shape of buffer A is (4, 6)"
456  "then A[i, j] will be first rewritten to "
457  "A[(6 * i + j) / 12, (6 * i + j) / 4 % 3 , (6 * i + j) % 4] according to the `extents`,"
458  "and then reordered to A[(6 * i + j) / 12, (6 * i + j) % 4 , (6 * i + j) / 4 % 3]"
459  "according to `reorder`");
460  }
461 };
462 
464 struct ShapeOfAttrs : public tvm::AttrsNode<ShapeOfAttrs> {
466 
467  TVM_DECLARE_ATTRS(ShapeOfAttrs, "relay.attrs.ShapeOfAttrs") {
468  TVM_ATTR_FIELD(dtype).describe("Target data type").set_default(NullValue<DataType>());
469  }
470 };
471 
472 struct SequenceMaskAttrs : public tvm::AttrsNode<SequenceMaskAttrs> {
473  double mask_value;
474  int axis;
475 
476  TVM_DECLARE_ATTRS(SequenceMaskAttrs, "relay.attrs.SequenceMaskAttrs") {
477  TVM_ATTR_FIELD(mask_value).set_default(0).describe("The masking value.");
478  TVM_ATTR_FIELD(axis).set_default(0).describe(
479  "The axis of the length dimension. Can only be 0 or 1.");
480  }
481 }; // struct SequenceMaskAttrs.
482 
484 struct SparseToDenseAttrs : public tvm::AttrsNode<SparseToDenseAttrs> {
486 
487  TVM_DECLARE_ATTRS(SparseToDenseAttrs, "relay.attrs.SparseToDenseAttrs") {
488  TVM_ATTR_FIELD(output_shape).describe("Shape of the dense output tensor");
489  }
490 }; // struct SparseToDenseAttrs
491 
493 struct NdarraySizeAttrs : public tvm::AttrsNode<NdarraySizeAttrs> {
495 
496  TVM_DECLARE_ATTRS(NdarraySizeAttrs, "relay.attrs.NdarraySizeAttrs") {
497  TVM_ATTR_FIELD(dtype).describe("Target data type").set_default(NullValue<DataType>());
498  }
499 };
500 
502 struct OneHotAttrs : public tvm::AttrsNode<OneHotAttrs> {
503  int depth;
504  int axis;
506 
507  TVM_DECLARE_ATTRS(OneHotAttrs, "relay.attrs.OneHotAttrs") {
508  TVM_ATTR_FIELD(depth).set_default(1).describe("Depth of the one hot dimension.");
509  TVM_ATTR_FIELD(axis).set_default(-1).describe("Axis to fill.");
510  TVM_ATTR_FIELD(dtype).set_default(NullValue<DataType>()).describe("Output data type.");
511  }
512 }; // struct OneHotAttrs
513 
515 struct MatrixSetDiagAttrs : public tvm::AttrsNode<MatrixSetDiagAttrs> {
516  int k1;
517  int k2;
520 
521  TVM_DECLARE_ATTRS(MatrixSetDiagAttrs, "relay.attrs.MatrixSetDiagAttrs") {
522  TVM_ATTR_FIELD(k1).set_default(0).describe("Lower limit (included) of the range of diagonals.");
523  TVM_ATTR_FIELD(k2).set_default(0).describe("Upper limit (included) of the range of diagonals.");
524  TVM_ATTR_FIELD(super_diag_right_align)
525  .set_default(true)
526  .describe("Bool, true iff super-diagonal is right aligned (left-padded).");
527  TVM_ATTR_FIELD(sub_diag_right_align)
528  .set_default(false)
529  .describe("Bool, true iff sub-diagonal is right aligned (left-padded).");
530  }
531 }; // struct MatrixSetDiagAttrs
532 
534 struct ScanopAttrs : public tvm::AttrsNode<ScanopAttrs> {
537  Bool exclusive = Bool(false);
538  TVM_DECLARE_ATTRS(ScanopAttrs, "relay.attrs.ScanopAttrs") {
539  TVM_ATTR_FIELD(axis).describe("The axis to operate over").set_default(NullValue<Integer>());
540  TVM_ATTR_FIELD(dtype).describe("Output data type").set_default(NullValue<DataType>());
541 
542  // Default is 0 which is "false"
543  TVM_ATTR_FIELD(exclusive)
544  .describe("The first element is not included")
545  .set_default(Bool(false));
546  }
547 }; // struct ScanopAttrs
548 
550 struct UniqueAttrs : public tvm::AttrsNode<UniqueAttrs> {
551  bool sorted;
553  TVM_DECLARE_ATTRS(UniqueAttrs, "relay.attrs.UniqueAttrs") {
554  TVM_ATTR_FIELD(sorted).describe("Whether the unique elements are sorted").set_default(true);
555  TVM_ATTR_FIELD(return_counts)
556  .describe("Whether to return an additional tensor with counts of each unique elements")
557  .set_default(false);
558  }
559 }; // struct UniqueAttrs
560 
562 struct EinsumAttrs : public tvm::AttrsNode<EinsumAttrs> {
564 
565  TVM_DECLARE_ATTRS(EinsumAttrs, "relay.attrs.EinsumAttrs") {
566  TVM_ATTR_FIELD(equation).describe("The einsum expression string");
567  }
568 }; // struct EinsumAttrs
569 
571 struct StftAttrs : public tvm::AttrsNode<StftAttrs> {
572  int n_fft;
576  bool onesided;
577 
578  TVM_DECLARE_ATTRS(StftAttrs, "relay.attrs.StftAttrs") {
579  TVM_ATTR_FIELD(n_fft).set_default(-1).describe("The size of Fourier transform");
580  TVM_ATTR_FIELD(hop_length)
581  .set_default(-1)
582  .describe("The distance between neighboring sliding window frames");
583  TVM_ATTR_FIELD(win_length).set_default(-1).describe("The size of window frame and STFT filter");
584  TVM_ATTR_FIELD(normalized)
585  .set_default(false)
586  .describe("Whether to return the normalized STFT results");
587  TVM_ATTR_FIELD(onesided).set_default(true).describe(
588  "Whether to return onesided result or fill with conjugate symmetry");
589  }
590 }; // struct StftAttrs
591 
593 struct DFTAttrs : public tvm::AttrsNode<DFTAttrs> {
594  Bool inverse = Bool(false);
595 
596  TVM_DECLARE_ATTRS(DFTAttrs, "relay.attrs.DFTAttrs") {
597  TVM_ATTR_FIELD(inverse)
598  .describe("Whether to perform the inverse discrete Fourier transform")
599  .set_default(Bool(false));
600  }
601 }; // struct DFTAttrs
602 
603 struct TriluAttrs : public tvm::AttrsNode<TriluAttrs> {
604  bool upper;
605 
606  TVM_DECLARE_ATTRS(TriluAttrs, "relay.attrs.TriluAttrs") {
607  TVM_ATTR_FIELD(upper).set_default(true).describe(
608  "Whether to keep the upper or lower half of the diagonal.");
609  }
610 }; // struct TriluAttrs
611 
612 } // namespace relay
613 } // namespace tvm
614 #endif // TVM_RELAY_ATTRS_TRANSFORM_H_
DataType dtype
Definition: transform.h:220
std::string dst_layout
Definition: transform.h:437
int rhs_begin
Definition: transform.h:135
Attributes used in stft operator.
Definition: transform.h:571
double a_max
Definition: transform.h:384
TVM_DECLARE_ATTRS(ReshapeLikeAttrs, "relay.attrs.ReshapeLikeAttrs")
Definition: transform.h:137
Integer axis
Definition: transform.h:289
TVM_DECLARE_ATTRS(StridedSliceAttrs, "relay.attrs.StridedSliceAttrs")
Definition: transform.h:351
Array< Integer > axes
Definition: transform.h:371
int lhs_begin
Definition: transform.h:133
TVM_DECLARE_ATTRS(MatrixSetDiagAttrs, "relay.attrs.MatrixSetDiagAttrs")
Definition: transform.h:521
data type cast
Definition: transform.h:61
TVM_DECLARE_ATTRS(ScatterElementsAttrs, "relay.attrs.ScatterElementsAttrs")
Definition: transform.h:155
Boolean constant.
Definition: expr.h:587
Attributes for FixedPointMultiply operator.
Definition: transform.h:393
int axis
Definition: transform.h:71
bool allowzero
Definition: transform.h:122
TVM_DECLARE_ATTRS(NdarraySizeAttrs, "relay.attrs.NdarraySizeAttrs")
Definition: transform.h:496
TVM_DECLARE_ATTRS(ReshapeAttrs, "relay.attrs.ReshapeAttrs")
Definition: transform.h:123
TVM_DECLARE_ATTRS(ExpandDimsAttrs, "relay.attrs.ExpandDimsAttrs")
Definition: transform.h:74
TVM_DECLARE_ATTRS(LayoutTransformAttrs, "relay.attrs.LayoutTransformAttrs")
Definition: transform.h:427
std::string src_layout
Definition: transform.h:424
int axis
Definition: transform.h:504
Attributes used in expand_dims operators.
Definition: transform.h:70
Relay expression language.
Attributes used in DFT operator.
Definition: transform.h:593
Attributes used in matrix_set_diag operator.
Definition: transform.h:515
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Array< Integer > axes
Definition: transform.h:113
TVM_DECLARE_ATTRS(DynExpandDimsAttrs, "relay.attrs.DynExpandDimsAttrs")
Definition: transform.h:91
Attributes used in unique operator.
Definition: transform.h:550
DataType dtype
Definition: transform.h:505
int axis
Definition: transform.h:329
DataType dtype
Definition: transform.h:62
TVM_DECLARE_ATTRS(ShapeOfAttrs, "relay.attrs.ShapeOfAttrs")
Definition: transform.h:467
Attributes that specify a tensor.
Definition: transform.h:218
int axis
Definition: transform.h:474
Integer repeats
Definition: transform.h:267
TVM_DECLARE_ATTRS(StackAttrs, "relay.attrs.StackAttrs")
Definition: transform.h:259
Array< Integer > newshape
Definition: transform.h:121
Definition: transform.h:183
Attributes used in transpose operators.
Definition: transform.h:112
Attributes used in one-hot operator.
Definition: transform.h:502
int32_t multiplier
Definition: transform.h:394
TVM_DECLARE_ATTRS(ConcatenateAttrs, "relay.attrs.ConcatenateAttrs")
Definition: transform.h:102
Definition: transform.h:173
Attributes for Clip operator.
Definition: transform.h:382
TVM_DECLARE_ATTRS(DFTAttrs, "relay.attrs.DFTAttrs")
Definition: transform.h:596
int num_newaxis
Definition: transform.h:72
TVM_DECLARE_ATTRS(TileAttrs, "relay.attrs.TileAttrs")
Definition: transform.h:280
Attributes for StridedSlice operator.
Definition: transform.h:344
Optional< Array< Integer > > begin
Definition: transform.h:345
TVM_DECLARE_ATTRS(ClipAttrs, "relay.attrs.ClipAttrs")
Definition: transform.h:386
TVM_DECLARE_ATTRS(UniqueAttrs, "relay.attrs.UniqueAttrs")
Definition: transform.h:553
Helpers for attribute objects.
ObjectRef indices_or_sections
Definition: transform.h:328
Integer batch_dims
Definition: transform.h:184
Definition: transform.h:370
tvm::String slice_mode
Definition: transform.h:348
Optional< Array< Integer > > shape
Definition: transform.h:219
Attributes used in MXNet-style reshape_like operators.
Definition: transform.h:132
Defines a remapping of buffer indices.
Attributes used in dynamic expand_dims operators.
Definition: transform.h:88
TVM_DECLARE_ATTRS(SequenceMaskAttrs, "relay.attrs.SequenceMaskAttrs")
Definition: transform.h:476
Array< Integer > window_shape
Definition: transform.h:40
Expr start
Definition: transform.h:230
TVM_DECLARE_ATTRS(EinsumAttrs, "relay.attrs.EinsumAttrs")
Definition: transform.h:565
Attributes used in einsum operator.
Definition: transform.h:562
String equation
Definition: transform.h:563
Attributes used in cumsum and cumprod operator.
Definition: transform.h:534
String reduction
Definition: transform.h:153
Definition: transform.h:151
TVM_DECLARE_ATTRS(SparseToDenseAttrs, "relay.attrs.SparseToDenseAttrs")
Definition: transform.h:487
Integer batch_dims
Definition: transform.h:198
tvm::String mode
Definition: transform.h:200
Runtime primitive data type.
Definition: data_type.h:41
Attributes for LayoutTransform operator.
Definition: transform.h:423
Attributes used in arange operators.
Definition: transform.h:229
TVM_DECLARE_ATTRS(GatherNDAttrs, "relay.attrs.GatherNDAttrs")
Definition: transform.h:187
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Definition: index_map.h:177
Attributes used in reverse operators.
Definition: transform.h:288
Definition: transform.h:327
int axis
Definition: transform.h:39
TVM_DECLARE_ATTRS(ReverseAttrs, "relay.attrs.ReverseAttrs")
Definition: transform.h:290
double a_min
Definition: transform.h:383
int depth
Definition: transform.h:503
Attributes used in meshgrid operators.
Definition: transform.h:244
DataType dtype
Definition: transform.h:536
TVM_DECLARE_ATTRS(GatherAttrs, "relay.attrs.GatherAttrs")
Definition: transform.h:176
#define TVM_ATTR_FIELD(FieldName)
Declare an attribute field.
Definition: attrs.h:76
TVM_DECLARE_ATTRS(ArangeAttrs, "relay.attrs.ArangeAttrs")
Definition: transform.h:235
Integer axis
Definition: transform.h:152
Attributes used in tile operators.
Definition: transform.h:278
DataType dtype
Definition: transform.h:233
bool sorted
Definition: transform.h:551
Reference to string objects.
Definition: string.h:98
Definition: transform.h:603
String mode
Definition: transform.h:164
TVM_DECLARE_ATTRS(InitOpAttrs, "relay.attrs.InitOpAttrs")
Definition: transform.h:222
Managed reference to RelayExprNode.
Definition: expr.h:433
Attributes for MetaScheduleLayoutTransform operator.
Definition: transform.h:448
Expr stop
Definition: transform.h:231
Array< Integer > strides
Definition: transform.h:41
Integer lhs_end
Definition: transform.h:134
TVM_DECLARE_ATTRS(AutoSchedulerLayoutTransformAttrs, "relay.attrs.AutoSchedulerLayoutTransformAttrs")
Definition: transform.h:439
TVM_DECLARE_ATTRS(SqueezeAttrs, "relay.attrs.SqueezeAttrs")
Definition: transform.h:316
TVM_DECLARE_ATTRS(SliceLikeAttrs, "relay.attrs.SliceLikeAttrs")
Definition: transform.h:373
Integer axis
Definition: transform.h:535
Array< Integer > reps
Definition: transform.h:279
bool normalized
Definition: transform.h:575
Integer seq_axis
Definition: transform.h:299
TVM_DECLARE_ATTRS(ScatterNDAttrs, "relay.attrs.ScatterNDAttrs")
Definition: transform.h:166
bool super_diag_right_align
Definition: transform.h:518
bool return_counts
Definition: transform.h:552
TVM_DECLARE_ATTRS(StftAttrs, "relay.attrs.StftAttrs")
Definition: transform.h:578
Base class of all object reference.
Definition: object.h:511
DataType NullValue< DataType >()
Definition: attrs.h:90
bool is_rshift_required
Definition: transform.h:408
TVM_DECLARE_ATTRS(CastAttrs, "relay.attrs.CastAttrs")
Definition: transform.h:64
Attributes used in sparse_to_dense operator.
Definition: transform.h:484
std::string indexing
Definition: transform.h:245
int num_newaxis
Definition: transform.h:89
TVM_DECLARE_ATTRS(SlidingWindowAttrs, "relay.attrs.SlidingWindowAttrs")
Definition: transform.h:42
std::string src_layout
Definition: transform.h:436
TVM_DECLARE_ATTRS(TransposeAttrs, "relay.attrs.TransposeAttrs")
Definition: transform.h:114
bool onesided
Definition: transform.h:576
TVM_DECLARE_ATTRS(SplitAttrs, "relay.attrs.SplitAttrs")
Definition: transform.h:331
Attributes for ndarray_size operator.
Definition: transform.h:493
Optional< Array< Integer > > axes
Definition: transform.h:349
Definition: transform.h:163
TVM_DECLARE_ATTRS(MeshgridAttrs, "relay.attrs.MeshgridAttrs")
Definition: transform.h:247
Attributes used in stack operators.
Definition: transform.h:257
int32_t shift
Definition: transform.h:395
Attributes for per channel/per axes FixedPointMultiply operator.
Definition: transform.h:406
Definition: transform.h:197
Attributes used for the sliding_window operator.
Definition: transform.h:38
double mask_value
Definition: transform.h:473
DataType dtype
Definition: transform.h:494
The base class of the all the Use "curiously recurring template pattern".
Definition: attrs.h:834
DataType dtype
Definition: transform.h:465
bool sub_diag_right_align
Definition: transform.h:519
TVM_DECLARE_ATTRS(ReverseSequenceAttrs, "relay.attrs.ReverseSequenceAttrs")
Definition: transform.h:302
int k1
Definition: transform.h:516
Expr step
Definition: transform.h:232
Attributes used in repeat operators.
Definition: transform.h:266
tir::IndexMap index_map
Definition: transform.h:449
Optional< Array< Integer > > strides
Definition: transform.h:347
Attributes used in squeeze operators.
Definition: transform.h:312
bool is_lshift_required
Definition: transform.h:407
Base classes for the Relay IR.
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
std::string dst_layout
Definition: transform.h:425
Array< Integer > axis
Definition: transform.h:314
int hop_length
Definition: transform.h:573
Array< Integer > axes
Definition: transform.h:409
TVM_DECLARE_ATTRS(RepeatAttrs, "relay.attrs.RepeatAttrs")
Definition: transform.h:269
int axis
Definition: transform.h:101
Attributes for AutoSchedulerLayoutTransform operator.
Definition: transform.h:434
TObjectRef NullValue()
Create a NodeRef type that represents null.
Definition: attrs.h:84
TVM_DECLARE_ATTRS(TakeAttrs, "relay.attrs.TakeAttrs")
Definition: transform.h:202
Definition: transform.h:472
int win_length
Definition: transform.h:574
Integer rhs_end
Definition: transform.h:136
bool upper
Definition: transform.h:604
int n_fft
Definition: transform.h:572
Attributes used in reverse_sequence operators.
Definition: transform.h:298
Attributes used in reshape operators.
Definition: transform.h:120
Optional< Integer > index_rank
Definition: transform.h:185
TVM_DECLARE_ATTRS(OneHotAttrs, "relay.attrs.OneHotAttrs")
Definition: transform.h:507
Attributes for ShapeOf operator.
Definition: transform.h:464
Integer axis
Definition: transform.h:174
TVM_DECLARE_ATTRS(ScanopAttrs, "relay.attrs.ScanopAttrs")
Definition: transform.h:538
Array< Integer > output_shape
Definition: transform.h:485
Optional< Array< Integer > > end
Definition: transform.h:346
TVM_DECLARE_ATTRS(MetaScheduleLayoutTransformAttrs, "relay.attrs.MetaScheduleLayoutTransformAttrs")
Definition: transform.h:451
Integer axis
Definition: transform.h:268
Integer axis
Definition: transform.h:258
TVM_DECLARE_ATTRS(FixedPointMultiplyAttrs, "relay.attrs.FixedPointMultiplyAttrs")
Definition: transform.h:397
int k2
Definition: transform.h:517
Attributes used in concatenate operators.
Definition: transform.h:100
TVM_DECLARE_ATTRS(FixedPointMultiplyPerAxisAttrs, "relay.attrs.FixedPointMultiplyPerAxisAttrs")
Definition: transform.h:411
Integer batch_axis
Definition: transform.h:300
TVM_DECLARE_ATTRS(TriluAttrs, "relay.attrs.TriluAttrs")
Definition: transform.h:606
Container of constant int that adds more constructors.
Definition: expr.h:622
Integer axis
Definition: transform.h:199