tvm
nn.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_NN_H_
25 #define TVM_RELAY_ATTRS_NN_H_
26 
27 #include <tvm/ir/attrs.h>
28 #include <tvm/relay/base.h>
29 
30 #include <string>
31 
32 namespace tvm {
33 namespace relay {
34 
42 struct BiasAddAttrs : public tvm::AttrsNode<BiasAddAttrs> {
43  int axis;
44 
45  TVM_DECLARE_ATTRS(BiasAddAttrs, "relay.attrs.BiasAddAttrs") {
46  TVM_ATTR_FIELD(axis).describe("The axis to add the bias").set_default(1);
47  }
48 };
49 
51 struct Conv1DAttrs : public tvm::AttrsNode<Conv1DAttrs> {
55  int groups;
62 
63  TVM_DECLARE_ATTRS(Conv1DAttrs, "relay.attrs.Conv1DAttrs") {
65  .set_default(Array<IndexExpr>({
66  1,
67  }))
68  .describe("Specifies the stride of the convolution.");
70  .set_default(Array<IndexExpr>({0, 0}))
71  .describe(
72  "If padding is non-zero, then the input is implicitly zero-padded"
73  "on both sides for padding number of points");
75  .set_default(Array<IndexExpr>({
76  1,
77  }))
78  .describe("Specifies the dilation rate to use for dilated convolution.");
79  TVM_ATTR_FIELD(groups).set_default(1).describe(
80  "Currently unused but may be added in the future.");
82  .describe(
83  "The number of output channels in the convolution."
84  " If it is not set, inferred by shape of the weight.")
85  .set_default(NullValue<IndexExpr>());
87  .describe("Specifies the dimensions of the convolution window.")
88  .set_default(NullValue<Array<IndexExpr>>());
90  .set_default("NCW")
91  .describe(
92  "Dimension ordering of input data. Can be 'NCW', 'NWC', etc."
93  "'N', 'C', 'W' stands for batch, channel, and width"
94  "dimensions respectively. Convolution is applied on the 'W'"
95  "dimension.");
97  .set_default("OIW")
98  .describe(
99  "Dimension ordering of weight. Can be 'OIW', or 'WIO', etc."
100  "'O', 'I', 'W' stands for num_filter, input_channel, and width"
101  "dimensions respectively.");
103  .set_default("")
104  .describe(
105  "Dimension ordering of output. Can be 'NCW', 'NWC', etc."
106  "'N', 'C', 'W' stands for batch, channel, and width"
107  "dimensions respectively. Default to be same as input layout.");
108 
109  // use 0 bits to indicate none.
111  .set_default(NullValue<DataType>())
112  .describe("Output data type, set to explicit type under mixed precision setting");
113  }
114 };
115 
117 struct Conv2DAttrs : public tvm::AttrsNode<Conv2DAttrs> {
121  int groups;
127  tvm::String auto_scheduler_rewritten_layout; // The layout after auto-scheduler's layout rewrite
128  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
130 
131  TVM_DECLARE_ATTRS(Conv2DAttrs, "relay.attrs.Conv2DAttrs") {
133  .set_default(Array<IndexExpr>({1, 1}))
134  .describe("Specifies the strides of the convolution.");
136  .set_default(Array<IndexExpr>({0, 0}))
137  .describe(
138  "If padding is non-zero, then the input is implicitly zero-padded"
139  "Padding support both symmetric and asymmetric as"
140  "one int : same padding used on all sides"
141  "two int : bottom, right will use same padding as top, left"
142  "four int : padding width in the order of (top, left, bottom, right)");
144  .set_default(Array<IndexExpr>({1, 1}))
145  .describe("Specifies the dilation rate to use for dilated convolution.");
146  TVM_ATTR_FIELD(groups).set_default(1).describe(
147  "Controls the connections between inputs and outputs."
148  "At groups=1, all inputs are convolved to all outputs."
149  "At groups=2, the operation becomes equivalent to having two convolution"
150  "layers side by side, each seeing half the input channels, and producing"
151  "half the output channels, and both subsequently concatenated.");
153  .describe(
154  "The number of output channels in the convolution."
155  " If it is not set, inferred by shape of the weight.")
156  .set_default(NullValue<IndexExpr>());
158  .describe("Specifies the dimensions of the convolution window.")
159  .set_default(NullValue<Array<IndexExpr>>());
161  .set_default("NCHW")
162  .describe(
163  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
164  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
165  "dimensions respectively. Convolution is applied on the 'H' and"
166  "'W' dimensions.");
168  .set_default("OIHW")
169  .describe(
170  "Dimension ordering of weight. Can be 'OIHW', 'OIHW16o16i', etc."
171  "'O', 'I', 'H', 'W' stands for num_filter, input_channel, height, and width"
172  "dimensions respectively.");
174  .set_default("")
175  .describe(
176  "Dimension ordering of output. Can be 'NCHW', 'NHWC', etc."
177  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
178  "dimensions respectively. Default to be same as input layout.");
179 
180  // use 0 bits to indicate none.
182  .set_default(NullValue<DataType>())
183  .describe("Output data type, set to explicit type under mixed precision setting");
184  }
185 };
186 
188 struct ConvWinogradWeightTransformAttrs : public tvm::AttrsNode<ConvWinogradWeightTransformAttrs> {
190 
192  "relay.attrs.ConvWinogradWeightTransformAttrs") {
193  TVM_ATTR_FIELD(tile_size).describe(
194  "Tile size of winograd. E.g. 2 for F(2x2, 3x3) and 4 for F(4x4, 3x3)");
195  }
196 };
197 
199 struct ConvGemmWeightTransformAttrs : public tvm::AttrsNode<ConvGemmWeightTransformAttrs> {
200  int tile_N;
201  int tile_K;
202 
203  TVM_DECLARE_ATTRS(ConvGemmWeightTransformAttrs, "relay.attrs.ConvGemmWeightTransformAttrs") {
204  TVM_ATTR_FIELD(tile_N).describe(
205  "Tile size across N axis of the weight transformation for ConvGemm. (N = OC)");
206  TVM_ATTR_FIELD(tile_K).describe(
207  "Tile size across K axis of the weight transformation for ConvGemm. (K = KW * KH * IC)");
208  }
209 };
210 
212 struct Conv2DWinogradAttrs : public tvm::AttrsNode<Conv2DWinogradAttrs> {
217  int groups;
223  tvm::String auto_scheduler_rewritten_layout; // The layout after auto-scheduler's layout rewrite
224  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
226 
227  TVM_DECLARE_ATTRS(Conv2DWinogradAttrs, "relay.attrs.Conv2DWinogradAttrs") {
228  TVM_ATTR_FIELD(tile_size).describe(
229  "The tile size of winograd. E.g. 2 for F(2x2, 3x3) and 4 for F(4x4, 3x3)");
231  .set_default(Array<IndexExpr>({1, 1}))
232  .describe("Specifies the strides of the convolution.");
234  .set_default(Array<IndexExpr>({0, 0}))
235  .describe(
236  "If padding is non-zero, then the input is implicitly zero-padded"
237  "Padding support both symmetric and asymmetric as"
238  "one int : same padding used on all sides"
239  "two int : bottom, right will use same padding as top, left"
240  "four int : padding width in the order of (top, left, bottom, right)");
242  .set_default(Array<IndexExpr>({1, 1}))
243  .describe("Specifies the dilation rate to use for dilated convolution.");
244  TVM_ATTR_FIELD(groups).set_default(1).describe(
245  "Controls the connections between inputs and outputs."
246  "At groups=1, all inputs are convolved to all outputs."
247  "At groups=2, the operation becomes equivalent to having two convolution"
248  "layers side by side, each seeing half the input channels, and producing"
249  "half the output channels, and both subsequently concatenated.");
251  .describe(
252  "The number of output channels in the convolution."
253  " If it is not set, inferred by shape of the weight.")
254  .set_default(NullValue<IndexExpr>());
256  .describe("Specifies the dimensions of the convolution window.")
257  .set_default(NullValue<Array<IndexExpr>>());
259  .set_default("NCHW")
260  .describe(
261  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
262  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
263  "dimensions respectively. Convolution is applied on the 'H' and"
264  "'W' dimensions.");
266  .set_default("OIHW")
267  .describe(
268  "Dimension ordering of weight. Can be 'OIHW', 'OIHW16o16i', etc."
269  "'O', 'I', 'H', 'W' stands for num_filter, input_channel, height, and width"
270  "dimensions respectively.");
272  .set_default("")
273  .describe(
274  "Dimension ordering of output. Can be 'NCHW', 'NHWC', etc."
275  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
276  "dimensions respectively. Default to be same as input layout.");
277 
278  // use 0 bits to indicate none.
280  .set_default(NullValue<DataType>())
281  .describe("Output data type, set to explicit type under mixed precision setting");
282  }
283 };
284 
287  : public tvm::AttrsNode<Conv2DWinogradNNPACKWeightTransformAttrs> {
290 
292  "relay.attrs.Conv2DWinogradNNPACKWeightTransformAttrs") {
294  .describe(
295  "The convolution algorithm for Winograd NNPACK. "
296  "E.g. tvm.contrib.nnpack.ConvolutionAlgorithm.WT_8x8 for WT_8x8, "
297  "tvm.contrib.nnpack.ConvolutionAlgorithm.WT_8x8_FP16 for WT_8x8_FP16");
299  .set_default(NullValue<DataType>())
300  .describe("Output data type, set to explicit type under mixed precision setting");
301  }
302 };
303 
305 struct Conv3DAttrs : public tvm::AttrsNode<Conv3DAttrs> {
309  int groups;
315  tvm::String auto_scheduler_rewritten_layout; // The layout after auto-scheduler's layout rewrite
316  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
318 
319  TVM_DECLARE_ATTRS(Conv3DAttrs, "relay.attrs.Conv3DAttrs") {
321  .set_default(Array<IndexExpr>({1, 1, 1}))
322  .describe("Specifies the strides of the convolution.");
324  .set_default(Array<IndexExpr>({0, 0, 0}))
325  .describe(
326  "If padding is non-zero, then the input is implicitly zero-padded"
327  "Padding support both symmetric and asymmetric as"
328  "one int : same padding used on all sides"
329  "three int : back, bottom, right will use same padding as front, top, left"
330  "six int : padding width in the order of (front, top, left, back, bottom,"
331  "right)");
333  .set_default(Array<IndexExpr>({1, 1, 1}))
334  .describe("Specifies the dilation rate to use for dilated convolution.");
335  TVM_ATTR_FIELD(groups).set_default(1).describe(
336  "Controls the connections between inputs and outputs."
337  "At groups=1, all inputs are convolved to all outputs."
338  "At groups=2, the operation becomes equivalent to having two convolution"
339  "layers side by side, each seeing half the input channels, and producing"
340  "half the output channels, and both subsequently concatenated.");
342  .describe(
343  "The number of output channels in the convolution."
344  " If it is not set, inferred by shape of the weight.")
345  .set_default(NullValue<IndexExpr>());
347  .describe("Specifies the dimensions of the convolution window.")
348  .set_default(NullValue<Array<IndexExpr>>());
350  .set_default("NCDHW")
351  .describe(
352  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
353  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
354  "dimensions respectively. Convolution is applied on the 'D', 'H' and"
355  "'W' dimensions.");
357  .set_default("OIDHW")
358  .describe(
359  "Dimension ordering of weight. Can be 'OIDHW', 'OIDHW16o16i', etc."
360  "'O', 'I', 'D', 'H', 'W' stands for num_filter, input_channel, depth, height,"
361  "and width dimensions respectively.");
363  .set_default("")
364  .describe(
365  "Dimension ordering of output. Can be 'NCDHW', 'NDHWC', etc."
366  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
367  "dimensions respectively. Default to be same as input layout.");
368 
369  // use 0 bits to indicate none.
371  .set_default(NullValue<DataType>())
372  .describe("Output data type, set to explicit type under mixed precision setting");
373  }
374 };
375 
377 struct Conv3DTransposeAttrs : public tvm::AttrsNode<Conv3DTransposeAttrs> {
384  int groups;
389 
390  TVM_DECLARE_ATTRS(Conv3DTransposeAttrs, "relay.attrs.Conv3DTransposeAttrs") {
392  .set_default(NullValue<IndexExpr>())
393  .describe(
394  "The dimensionality of the output space"
395  "i.e. the number of output channels in the convolution.");
397  .describe("The dimensions of the convolution window.")
398  .set_default(NullValue<Array<IndexExpr>>());
400  .set_default(Array<IndexExpr>({1, 1, 1}))
401  .describe("The strides of the convolution.");
403  .set_default(Array<IndexExpr>({0, 0, 0}))
404  .describe(
405  "Zero-padding added to one side of the output."
406  "Padding support both symmetric and asymmetric as"
407  "one int : same padding used on all sides"
408  "three int : front, bottom, right will use same padding as back, top, left"
409  "six int : padding width in the order of (front, top, left, back, bottom, right)");
411  .set_default(Array<IndexExpr>({0, 0, 0}))
412  .describe(
413  "If padding is non-zero, then the input is implicitly zero-padded"
414  "Padding support both symmetric and asymmetric as"
415  "one int : same padding used on all sides"
416  "three int : front, bottom, right will use same padding as back, top, left"
417  "six int : padding width in the order of (front, top, left, back, bottom, right)");
419  .set_default(Array<IndexExpr>({1, 1, 1}))
420  .describe("Specifies the dilation rate to use for dilated convolution.");
421  TVM_ATTR_FIELD(groups).set_default(1).describe(
422  "Controls the connections between inputs and outputs."
423  "At groups=1, all inputs are convolved to all outputs."
424  "At groups=2, the operation becomes equivalent to having two convolution"
425  "layers side by side, each seeing half the input channels, and producing"
426  "half the output channels, and both subsequently concatenated.");
428  .set_default("NCDHW")
429  .describe(
430  "Dimension ordering of data. Can be 'NCDHW', 'NDHWC', etc."
431  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
432  "dimensions respectively. Convolution is applied on the 'D', 'H' and"
433  "'W' dimensions.");
435  .set_default("IODHW")
436  .describe(
437  "Dimension ordering of data and weight. Can be 'IODHW', 'IODHW16i16o', etc."
438  "'I', 'O', 'D', 'H', 'W' stands for input_channel, num_filter, depth, height, and width"
439  "dimensions respectively.");
441  .set_default("")
442  .describe(
443  "Dimension ordering of output. Can be 'NCDHW', 'NDHWC', etc."
444  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
445  "dimensions respectively. Default to be same as input layout.");
447  .set_default(NullValue<DataType>())
448  .describe("Output data type, set to explicit type under mixed precision setting");
449  }
450 };
451 
453 struct Conv3DWinogradAttrs : public tvm::AttrsNode<Conv3DWinogradAttrs> {
458  int groups;
461  std::string data_layout;
462  std::string kernel_layout;
463  std::string out_layout;
465 
466  TVM_DECLARE_ATTRS(Conv3DWinogradAttrs, "relay.attrs.Conv3DWinogradAttrs") {
467  TVM_ATTR_FIELD(tile_size).describe(
468  "The tile size of winograd. E.g. 2 for F(2x2x2, 3x3x3) and 4 for F(4x4x4, 3x3x3)");
470  .set_default(Array<IndexExpr>({1, 1, 1}))
471  .describe("Specifies the strides of the convolution.");
473  .set_default(Array<IndexExpr>({0, 0, 0}))
474  .describe(
475  "If padding is non-zero, then the input is implicitly zero-padded"
476  "Padding support both symmetric and asymmetric as"
477  "one int : same padding used on all sides"
478  "three int : back, bottom, right will use same padding as front, top, left"
479  "six int : padding width in the order of (front, top, left, back, bottom,"
480  "right)");
482  .set_default(Array<IndexExpr>({1, 1, 1}))
483  .describe("Specifies the dilation rate to use for dilated convolution.");
484  TVM_ATTR_FIELD(groups).set_default(1).describe(
485  "Controls the connections between inputs and outputs."
486  "At groups=1, all inputs are convolved to all outputs."
487  "At groups=2, the operation becomes equivalent to having two convolution"
488  "layers side by side, each seeing half the input channels, and producing"
489  "half the output channels, and both subsequently concatenated.");
491  .describe(
492  "The number of output channels in the convolution."
493  " If it is not set, inferred by shape of the weight.")
494  .set_default(NullValue<IndexExpr>());
496  .describe("Specifies the dimensions of the convolution window.")
497  .set_default(NullValue<Array<IndexExpr>>());
499  .set_default("NCDHW")
500  .describe(
501  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
502  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
503  "dimensions respectively. Convolution is applied on the 'D', 'H' and"
504  "'W' dimensions.");
506  .set_default("OIDHW")
507  .describe(
508  "Dimension ordering of weight. Can be 'OIDHW', 'OIDHW16o16i', etc."
509  "'O', 'I', 'D', 'H', 'W' stands for num_filter, input_channel, depth, height,"
510  "and width dimensions respectively.");
512  .set_default("")
513  .describe(
514  "Dimension ordering of output. Can be 'NCDHW', 'NDHWC', etc."
515  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
516  "dimensions respectively. Default to be same as input layout.");
517 
518  // use 0 bits to indicate none.
520  .set_default(NullValue<DataType>())
521  .describe("Output data type, set to explicit type under mixed precision setting");
522  }
523 };
524 
526 struct SoftmaxAttrs : public tvm::AttrsNode<SoftmaxAttrs> {
527  int axis;
528 
529  TVM_DECLARE_ATTRS(SoftmaxAttrs, "relay.attrs.SoftmaxAttrs") {
530  TVM_ATTR_FIELD(axis).set_default(-1).describe("The axis to sum over when computing softmax.");
531  }
532 };
533 
535 struct Conv2DTransposeAttrs : public tvm::AttrsNode<Conv2DTransposeAttrs> {
542  int groups;
543  std::string data_layout;
544  std::string kernel_layout;
545  std::string out_layout;
547 
548  TVM_DECLARE_ATTRS(Conv2DTransposeAttrs, "relay.attrs.Conv2DTransposeAttrs") {
550  .set_default(NullValue<IndexExpr>())
551  .describe(
552  "The dimensionality of the output space"
553  "i.e. the number of output channels in the convolution.");
555  .describe("The dimensions of the convolution window.")
556  .set_default(NullValue<Array<IndexExpr>>());
558  .set_default(Array<IndexExpr>({1, 1}))
559  .describe("The strides of the convolution.");
561  .set_default(Array<IndexExpr>({0, 0}))
562  .describe(
563  "Zero-padding added to one side of the output."
564  "Padding support both symmetric and asymmetric as"
565  "one int : same padding used on all sides"
566  "two int : bottom, right will use same padding as top, left"
567  "four int : padding width in the order of (top, left, bottom, right)");
569  .set_default(Array<IndexExpr>({0, 0}))
570  .describe(
571  "If padding is non-zero, then the input is implicitly zero-padded"
572  "Padding support both symmetric and asymmetric as"
573  "one int : same padding used on all sides"
574  "two int : bottom, right will use same padding as top, left"
575  "four int : padding width in the order of (top, left, bottom, right)");
577  .set_default(Array<IndexExpr>({1, 1}))
578  .describe("Specifies the dilation rate to use for dilated convolution.");
579  TVM_ATTR_FIELD(groups).set_default(1).describe(
580  "Controls the connections between inputs and outputs."
581  "At groups=1, all inputs are convolved to all outputs."
582  "At groups=2, the operation becomes equivalent to having two convolution"
583  "layers side by side, each seeing half the input channels, and producing"
584  "half the output channels, and both subsequently concatenated.");
586  .set_default("NCHW")
587  .describe(
588  "Dimension ordering of data. Can be 'NCHW', 'NHWC', etc."
589  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
590  "dimensions respectively. Convolution is applied on the 'H' and"
591  "'W' dimensions.");
593  .set_default("IOHW")
594  .describe(
595  "Dimension ordering of data and weight. Can be 'IOHW', 'OIHW16o16i', etc."
596  "'I', 'O', 'H', 'W' stands for input_channel, num_filter, height, and width"
597  "dimensions respectively.");
599  .set_default("")
600  .describe(
601  "Dimension ordering of output. Can be 'NCHW', 'NHWC', etc."
602  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
603  "dimensions respectively. Default to be same as input layout.");
605  .set_default(NullValue<DataType>())
606  .describe("Output data type, set to explicit type under mixed precision setting");
607  }
608 };
609 
611 struct DilateAttrs : public tvm::AttrsNode<DilateAttrs> {
614 
615  TVM_DECLARE_ATTRS(DilateAttrs, "relay.attrs.DilateAttrs") {
617  .set_default(Array<IndexExpr>({1, 1}))
618  .describe("Dilation stride on each dimension, 1 means no dilation.");
619  TVM_ATTR_FIELD(dilation_value).set_default(0.0).describe("Value used to dilate the input.");
620  }
621 };
622 
624 struct Conv1DTransposeAttrs : public tvm::AttrsNode<Conv1DTransposeAttrs> {
631  int groups;
632  std::string data_layout;
633  std::string kernel_layout;
634  std::string out_layout;
636 
637  TVM_DECLARE_ATTRS(Conv1DTransposeAttrs, "relay.attrs.Conv1DTransposeAttrs") {
639  .set_default(NullValue<IndexExpr>())
640  .describe(
641  "The dimensionality of the output space"
642  "i.e. the number of output channels in the convolution.");
644  .describe("The dimensions of the convolution window.")
645  .set_default(NullValue<Array<IndexExpr>>());
647  .set_default(Array<IndexExpr>({1}))
648  .describe("The strides of the convolution.");
650  .set_default(Array<IndexExpr>({0}))
651  .describe("Zero-padding added to one side of the output.");
653  .set_default(Array<IndexExpr>({0}))
654  .describe(
655  "Symmetric or asymmetric padding."
656  "Single value: the input is implicitly zero-padded on both sides."
657  "Two values: padding[0] is used for left input padding, "
658  "padding[1] is used for right input padding,");
660  .set_default(Array<IndexExpr>({1}))
661  .describe("Specifies the dilation rate to use for dilated convolution.");
662  TVM_ATTR_FIELD(groups).set_default(1).describe(
663  "Controls the connections between inputs and outputs."
664  "At groups=1, all inputs are convolved to all outputs."
665  "At groups=2, the operation becomes equivalent to having two convolution"
666  "layers side by side, each seeing half the input channels, and producing"
667  "half the output channels, and both subsequently concatenated.");
669  .set_default("NCW")
670  .describe(
671  "Dimension ordering of data. Can be 'NCW', 'NWC', etc."
672  "'N', 'C', 'W' stands for batch, channel, and width"
673  "dimensions respectively. Convolution is applied on the"
674  "'W' dimension.");
676  .set_default("IOW")
677  .describe(
678  "Dimension ordering of data and weight. Can be 'IOW', 'IOW16o16i', etc."
679  "'I', 'O', 'W' stands for input_channel, num_filter and width"
680  "dimensions respectively.");
682  .set_default("")
683  .describe(
684  "Dimension ordering of output. Can be 'NCW', 'NWC', etc."
685  "'N', 'C', 'W' stands for batch, channel, and width"
686  "dimensions respectively. Default to be same as input layout.");
688  .set_default(NullValue<DataType>())
689  .describe("Output data type, set to explicit type under mixed precision setting");
690  }
691 };
692 
694 struct MaxPool2DAttrs : public tvm::AttrsNode<MaxPool2DAttrs> {
701  bool ceil_mode;
702 
703  TVM_DECLARE_ATTRS(MaxPool2DAttrs, "relay.attrs.MaxPool2DAttrs") {
704  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
706  .set_default(Array<IndexExpr>({1, 1}))
707  .describe("Specifies the strides of the convolution.");
709  .set_default(Array<IndexExpr>({1, 1}))
710  .describe("Specifies the dilation of the convolution.");
712  .set_default(Array<IndexExpr>({0, 0}))
713  .describe(
714  "If padding is non-zero, then the input is implicitly zero-padded"
715  "Padding support both symmetric and asymmetric as"
716  "one int : same padding used on all sides"
717  "two int : bottom, right will use same padding as top, left"
718  "four int : padding width in the order of (top, left, bottom, right)");
719  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
720  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
721  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
722  "dimensions respectively. Pooling is applied on the 'H' and"
723  "'W' dimensions.");
725  .set_default("")
726  .describe(
727  "Dimension ordering of output data. Can be 'NCHW', 'NHWC', etc."
728  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
729  "dimensions respectively. Pooling is applied on the 'H' and"
730  "'W' dimensions.");
731  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
732  "When true, will use ceil instead of floor to compute the output shape.");
733  }
734 };
735 
737 struct AvgPool2DAttrs : public tvm::AttrsNode<AvgPool2DAttrs> {
744  bool ceil_mode;
746 
747  TVM_DECLARE_ATTRS(AvgPool2DAttrs, "relay.attrs.AvgPool2DAttrs") {
748  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
750  .set_default(Array<IndexExpr>({1, 1}))
751  .describe("Specifies the strides of the convolution.");
753  .set_default(Array<IndexExpr>({1, 1}))
754  .describe("Specifies the dilation of the convolution.");
756  .set_default(Array<IndexExpr>({0, 0}))
757  .describe(
758  "If padding is non-zero, then the input is implicitly zero-padded"
759  "Padding support both symmetric and asymmetric as"
760  "one int : same padding used on all sides"
761  "two int : bottom, right will use same padding as top, left"
762  "four int : padding width in the order of (top, left, bottom, right)");
763  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
764  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
765  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
766  "dimensions respectively. Pooling is applied on the 'H' and"
767  "'W' dimensions.");
769  .set_default("")
770  .describe(
771  "Dimension ordering of output data. Can be 'NCHW', 'NHWC', etc."
772  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
773  "dimensions respectively. Pooling is applied on the 'H' and"
774  "'W' dimensions.");
775  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
776  "When true, will use ceil instead of floor to compute the output shape.");
778  .set_default(false)
779  .describe("When true, will include padding to compute the average");
780  }
781 };
782 
784 struct GlobalPool2DAttrs : public tvm::AttrsNode<GlobalPool2DAttrs> {
787 
788  TVM_DECLARE_ATTRS(GlobalPool2DAttrs, "relay.attrs.GlobalPool2DAttrs") {
789  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
790  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
791  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
792  "dimensions respectively. Pooling is applied on the 'H' and"
793  "'W' dimensions.");
795  .set_default("")
796  .describe(
797  "Dimension ordering of output data. Can be 'NCHW', 'NHWC', etc."
798  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
799  "dimensions respectively. Pooling is applied on the 'H' and"
800  "'W' dimensions.");
801  }
802 };
803 
805 struct AdaptivePool1DAttrs : public tvm::AttrsNode<AdaptivePool1DAttrs> {
807  std::string layout;
809 
810  TVM_DECLARE_ATTRS(AdaptivePool1DAttrs, "relay.attrs.AdaptivePool1DAttrs") {
811  TVM_ATTR_FIELD(output_size).set_default(Array<IndexExpr>({})).describe("Output width.");
812  TVM_ATTR_FIELD(layout).set_default("NCW").describe(
813  "Dimension ordering of input data. Can be 'NCW', 'NWC', etc."
814  "'N', 'C', 'W' stands for batch, channel, and width"
815  "dimensions respectively. Pooling is applied on the"
816  "'W' dimension.");
818  .set_default("")
819  .describe(
820  "Dimension ordering of output data. Can be 'NCW', 'NWC', etc."
821  "'N', 'C', 'W' stands for batch, channel, and width"
822  "dimensions respectively. Pooling is applied on the"
823  "'W' dimension.");
824  }
825 };
826 
828 struct AdaptivePool2DAttrs : public tvm::AttrsNode<AdaptivePool2DAttrs> {
830  std::string layout;
832 
833  TVM_DECLARE_ATTRS(AdaptivePool2DAttrs, "relay.attrs.AdaptivePool2DAttrs") {
835  .set_default(Array<IndexExpr>({}))
836  .describe("Output height and width.");
837  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
838  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
839  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
840  "dimensions respectively. Pooling is applied on the 'H' and"
841  "'W' dimensions.");
843  .set_default("")
844  .describe(
845  "Dimension ordering of output data. Can be 'NCHW', 'NHWC', etc."
846  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
847  "dimensions respectively. Pooling is applied on the 'H' and"
848  "'W' dimensions.");
849  }
850 };
851 
853 struct AdaptivePool3DAttrs : public tvm::AttrsNode<AdaptivePool3DAttrs> {
855  std::string layout;
857 
858  TVM_DECLARE_ATTRS(AdaptivePool3DAttrs, "relay.attrs.AdaptivePool3DAttrs") {
860  .set_default(Array<IndexExpr>({}))
861  .describe("Output depth, height and width.");
862  TVM_ATTR_FIELD(layout).set_default("NCDHW").describe(
863  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
864  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
865  "dimensions respectively. Pooling is applied on 'D', 'H' and"
866  "'W' dimensions.");
868  .set_default("")
869  .describe(
870  "Dimension ordering of output data. Can be 'NCDHW', 'NDHWC', etc."
871  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
872  "dimensions respectively. Pooling is applied on 'D', 'H' and"
873  "'W' dimensions.");
874  }
875 };
876 
878 struct MaxPool1DAttrs : public tvm::AttrsNode<MaxPool1DAttrs> {
883  std::string layout;
885  bool ceil_mode;
886 
887  TVM_DECLARE_ATTRS(MaxPool1DAttrs, "relay.attrs.MaxPool1DAttrs") {
888  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
890  .set_default(Array<IndexExpr>({1}))
891  .describe("Specifies the strides of the convolution.");
893  .set_default(Array<IndexExpr>({1}))
894  .describe("Specifies the dilation of the convolution.");
896  .set_default(Array<IndexExpr>({0}))
897  .describe(
898  "If padding is non-zero, then the input is implicitly zero-padded"
899  "Padding supports both symmetric and asymmetric as"
900  "one int : same padding used on each side"
901  "two int : indicates left padding, right padding");
902  TVM_ATTR_FIELD(layout).set_default("NCW").describe(
903  "Dimension ordering of input data. Can be 'NCW', 'NWC', etc."
904  "'N', 'C', 'W' stands for batch, channel, and width"
905  "dimensions respectively. Pooling is applied on the 'W' dimensions.");
907  .set_default("")
908  .describe(
909  "Dimension ordering of output data. Can be 'NCW', 'NWC', etc."
910  "'N', 'C', 'W' stands for batch, channel, and width"
911  "dimensions respectively. Pooling is applied on the 'W' dimensions.");
912  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
913  "When true, will use ceil instead of floor to compute the output shape.");
914  }
915 };
916 
918 struct AvgPool1DAttrs : public tvm::AttrsNode<AvgPool1DAttrs> {
923  std::string layout;
925  bool ceil_mode;
927 
928  TVM_DECLARE_ATTRS(AvgPool1DAttrs, "relay.attrs.AvgPool1DAttrs") {
929  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
931  .set_default(Array<IndexExpr>({1}))
932  .describe("Specifies the strides of the convolution.");
934  .set_default(Array<IndexExpr>({1}))
935  .describe("Specifies the dilation of the convolution.");
937  .set_default(Array<IndexExpr>({0}))
938  .describe(
939  "If padding is non-zero, then the input is implicitly zero-padded"
940  "Padding supports both symmetric and asymmetric as"
941  "one int : same padding used on each side"
942  "two int : indicates left padding, right padding");
943  TVM_ATTR_FIELD(layout).set_default("NCW").describe(
944  "Dimension ordering of input data. Can be 'NCW', 'NHC', etc."
945  "'N', 'C', 'W' stands for batch, channel, and width"
946  "dimensions respectively. Pooling is applied on the 'W' dimension.");
948  .set_default("")
949  .describe(
950  "Dimension ordering of output data. Can be 'NCW', 'NHC', etc."
951  "'N', 'C', 'W' stands for batch, channel, and width"
952  "dimensions respectively. Pooling is applied on the 'W' dimension.");
953  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
954  "When true, will use ceil instead of floor to compute the output shape.");
956  .set_default(false)
957  .describe("When true, will include padding to compute the average");
958  }
959 };
960 
962 struct MaxPool3DAttrs : public tvm::AttrsNode<MaxPool3DAttrs> {
967  std::string layout;
969  bool ceil_mode;
970 
971  TVM_DECLARE_ATTRS(MaxPool3DAttrs, "relay.attrs.MaxPool3DAttrs") {
972  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
974  .set_default(Array<IndexExpr>({1, 1, 1}))
975  .describe("Specifies the strides of the convolution.");
977  .set_default(Array<IndexExpr>({1, 1, 1}))
978  .describe("Specifies the dilation of the convolution.");
980  .set_default(Array<IndexExpr>({0, 0, 0}))
981  .describe(
982  "If padding is non-zero, then the input is implicitly zero-padded"
983  "Padding support both symmetric and asymmetric as"
984  "one int : same padding used on all sides"
985  "three int : back, bottom, right will use same padding as front, top, left"
986  "six int : padding width in the order of (front, top, left, back, bottom, right)");
987  TVM_ATTR_FIELD(layout).set_default("NCDHW").describe(
988  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
989  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
990  "dimensions respectively. Pooling is applied on the 'D', 'H' and"
991  "'W' dimensions.");
993  .set_default("")
994  .describe(
995  "Dimension ordering of output data. Can be 'NCDHW', 'NDHWC', etc."
996  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
997  "dimensions respectively. Pooling is applied on the 'D', 'H' and"
998  "'W' dimensions.");
999  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
1000  "When true, will use ceil instead of floor to compute the output shape.");
1001  }
1002 };
1003 
1005 struct AvgPool3DAttrs : public tvm::AttrsNode<AvgPool3DAttrs> {
1010  std::string layout;
1014 
1015  TVM_DECLARE_ATTRS(AvgPool3DAttrs, "relay.attrs.AvgPool3DAttrs") {
1016  TVM_ATTR_FIELD(pool_size).describe("Size of the pooling windows.");
1018  .set_default(Array<IndexExpr>({1, 1, 1}))
1019  .describe("Specifies the strides of the convolution.");
1021  .set_default(Array<IndexExpr>({1, 1, 1}))
1022  .describe("Specifies the dilation of the convolution.");
1024  .set_default(Array<IndexExpr>({0, 0, 0}))
1025  .describe(
1026  "If padding is non-zero, then the input is implicitly zero-padded"
1027  "Padding support both symmetric and asymmetric as"
1028  "one int : same padding used on all sides"
1029  "three int : back, bottom, right will use same padding as front, top, left"
1030  "six int : padding width in the order of (front, top, left, back, bottom, right)");
1031  TVM_ATTR_FIELD(layout).set_default("NCDHW").describe(
1032  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
1033  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
1034  "dimensions respectively. Pooling is applied on the 'D', 'H' and"
1035  "'W' dimensions.");
1037  .set_default("")
1038  .describe(
1039  "Dimension ordering of output data. Can be 'NCDHW', 'NDHWC', etc."
1040  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
1041  "dimensions respectively. Pooling is applied on the 'D', 'H' and"
1042  "'W' dimensions.");
1043  TVM_ATTR_FIELD(ceil_mode).set_default(false).describe(
1044  "When true, will use ceil instead of floor to compute the output shape.");
1046  .set_default(false)
1047  .describe("When true, will include padding to compute the average");
1048  }
1049 };
1050 
1052 struct MatmulAttrs : public tvm::AttrsNode<MatmulAttrs> {
1057  // layout of B after auto-scheduler's layout rewrite
1059  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
1060 
1061  TVM_DECLARE_ATTRS(MatmulAttrs, "relay.attrs.MatmulAttrs") {
1062  TVM_ATTR_FIELD(units).describe("Number of hidden units of the dense transformation.");
1063 
1064  // use 0 bits to indicate none.
1066  .set_default(NullValue<DataType>())
1067  .describe("Output data type, set to explicit type under mixed precision setting");
1068 
1070  .set_default(false)
1071  .describe("Whether the first input tensor is in transposed format.");
1072 
1074  .set_default(false)
1075  .describe("Whether the second input tensor is in transposed format.");
1076  }
1077 };
1078 
1080 struct DenseAttrs : public tvm::AttrsNode<DenseAttrs> {
1082  // layout of B after auto-scheduler's layout rewrite
1084  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
1086 
1087  TVM_DECLARE_ATTRS(DenseAttrs, "relay.attrs.DenseAttrs") {
1088  TVM_ATTR_FIELD(units).describe("Number of hidden units of the dense transformation.");
1089 
1090  // use 0 bits to indicate none.
1092  .set_default(NullValue<DataType>())
1093  .describe("Output data type, set to explicit type under mixed precision setting");
1094  }
1095 };
1096 
1098 struct DensePackAttrs : public tvm::AttrsNode<DensePackAttrs> {
1102 
1103  TVM_DECLARE_ATTRS(DensePackAttrs, "relay.attrs.DensePackAttrs") {
1104  TVM_ATTR_FIELD(units).describe("Number of hidden units of the dense transformation.");
1105 
1106  // use 0 bits to indicate none.
1108  .set_default(NullValue<DataType>())
1109  .describe("Output data type, set to explicit type under mixed precision setting");
1111  .set_default("NC")
1112  .describe("Dimension ordering of weight. Packed layouts, such as NC8n, are possible.");
1113  }
1114 };
1115 
1117 struct BatchMatmulAttrs : public tvm::AttrsNode<BatchMatmulAttrs> {
1121  tvm::String auto_scheduler_rewritten_layout; // The layout after auto-scheduler's layout rewrite
1122  Array<PrimExpr> meta_schedule_original_shape; // The original shape of the weights
1123 
1124  TVM_DECLARE_ATTRS(BatchMatmulAttrs, "relay.attrs.BatchMatmulAttrs") {
1125  // use 0 bits to indicate none.
1127  .set_default(NullValue<DataType>())
1128  .describe("Output data type, set to explicit type under mixed precision setting");
1129 
1131  .set_default(false)
1132  .describe("Whether the first input tensor is in transposed format.");
1133 
1135  .set_default(false)
1136  .describe("Whether the second input tensor is in transposed format.");
1137  }
1138 };
1139 
1141 struct SparseDenseAttrs : public tvm::AttrsNode<SparseDenseAttrs> {
1143 
1144  TVM_DECLARE_ATTRS(SparseDenseAttrs, "relay.attrs.SparseDenseAttrs") {
1146  .set_default(false)
1147  .describe(
1148  "Indicate whether sparse matrix is multiplied on the right or the left. If true, then "
1149  "the operation is S * D^T (D dense, S sparse). If false, the operation is D * S^T");
1150  }
1151 };
1152 
1154 struct SparseTransposeAttrs : public tvm::AttrsNode<SparseTransposeAttrs> {
1155  TVM_DECLARE_ATTRS(SparseTransposeAttrs, "relay.attrs.SparseTransposeAttrs") {}
1156 };
1157 
1159 struct SparseConv2DAttrs : public tvm::AttrsNode<SparseConv2DAttrs> {
1160  std::string layout;
1162 
1163  TVM_DECLARE_ATTRS(SparseConv2DAttrs, "relay.attrs.SparseConv2DAttrs") {
1164  TVM_ATTR_FIELD(layout).set_default("NHWC").describe(
1165  "Dimension ordering of input data. Can be 'NCHW', 'NHWC'"
1166  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1167  "dimensions respectively.");
1169  .set_default(Array<IndexExpr>{1, 1})
1170  .describe("Kernel size for SparseConv2D, 1x1 or 3x3. ");
1171  }
1172 };
1173 
1175 struct FIFOBufferAttrs : public tvm::AttrsNode<FIFOBufferAttrs> {
1176  int axis;
1177 
1178  TVM_DECLARE_ATTRS(FIFOBufferAttrs, "relay.attrs.FIFOBufferAttrs") {
1179  TVM_ATTR_FIELD(axis).set_default(0);
1180  }
1181 };
1182 
1184 struct UpSamplingAttrs : public tvm::AttrsNode<UpSamplingAttrs> {
1185  double scale_h;
1186  double scale_w;
1190 
1191  TVM_DECLARE_ATTRS(UpSamplingAttrs, "relay.attrs.UpSamplingAttrs") {
1192  TVM_ATTR_FIELD(scale_h).describe("The upsampling factor for height");
1193  TVM_ATTR_FIELD(scale_w).describe("The upsampling factor for width");
1194  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
1195  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
1196  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1197  "dimensions respectively. Upsampling is applied on the 'H' and"
1198  "'W' dimensions.");
1200  .set_default("nearest_neighbor")
1201  .describe(
1202  "Specify the mode to use for scaling."
1203  "nearest_neighbor - Nearest Neighbor"
1204  "bilinear - Bilinear Interpolation"
1205  "bicubic - Bicubic Interpolation");
1207  .set_default(false)
1208  .describe("Should be true to preserve the values at the corner pixels");
1209  }
1210 };
1211 
1213 struct UpSampling3DAttrs : public tvm::AttrsNode<UpSampling3DAttrs> {
1214  double scale_d;
1215  double scale_h;
1216  double scale_w;
1217  std::string layout;
1218  std::string method;
1220 
1221  TVM_DECLARE_ATTRS(UpSampling3DAttrs, "relay.attrs.UpSampling3DAttrs") {
1222  TVM_ATTR_FIELD(scale_d).describe("The upsampling factor for depth");
1223  TVM_ATTR_FIELD(scale_h).describe("The upsampling factor for height");
1224  TVM_ATTR_FIELD(scale_w).describe("The upsampling factor for width");
1225  TVM_ATTR_FIELD(layout).set_default("NCDHW").describe(
1226  "Dimension ordering of input data. Can be 'NCDHW', 'NDHWC', etc."
1227  "'N', 'C', 'D', 'H', 'W' stands for batch, channel, depth, height, and width"
1228  "dimensions respectively. Upsampling is applied on the 'D', 'H' and"
1229  "'W' dimensions.");
1231  .set_default("nearest_neighbor")
1232  .describe(
1233  "Specify the mode to use for scaling."
1234  "nearest_neighbor - Nearest Neighbor"
1235  "trilinear - Trilinear Interpolation");
1237  .set_default("half_pixel")
1238  .describe(
1239  "Describes how to transform the coordinate in the resized tensor"
1240  "to the coordinate in the original tensor."
1241  "Refer to the ONNX Resize operator specification for details"
1242  "Available options are half_pixel, align_corners and asymmetric");
1243  }
1244 };
1245 
1247 struct PadAttrs : public tvm::AttrsNode<PadAttrs> {
1250 
1251  TVM_DECLARE_ATTRS(PadAttrs, "relay.attrs.PadAttrs") {
1252  TVM_ATTR_FIELD(pad_width).describe(
1253  "Number of values padded to the edges of each axis, "
1254  "in the format of ((before_1, after_1), ..., (before_N, after_N))");
1256  .set_default("constant")
1257  .describe(
1258  "Padding type to use. \"constant\" pads with constant_value, "
1259  "\"edge\" pads using the edge values of the input array, "
1260  "\"reflect\" pads by reflecting values with respect to the edges.");
1261  }
1262 };
1263 
1265 struct MirrorPadAttrs : public tvm::AttrsNode<MirrorPadAttrs> {
1266  std::string mode;
1268 
1269  TVM_DECLARE_ATTRS(MirrorPadAttrs, "relay.attrs.MirrorPadAttrs") {
1271  .set_default("SYMMETRIC")
1272  .describe("Specifies how mirroring should be performed.");
1273  TVM_ATTR_FIELD(pad_width).describe(
1274  "Number of values padded to the edges of each axis, "
1275  "in the format of ((before_1, after_1), ..., (before_N, after_N))");
1276  }
1277 };
1278 
1280 struct LeakyReluAttrs : public tvm::AttrsNode<LeakyReluAttrs> {
1281  double alpha;
1282 
1283  TVM_DECLARE_ATTRS(LeakyReluAttrs, "relay.attrs.LeakyReluAttrs") {
1284  TVM_ATTR_FIELD(alpha).set_lower_bound(0.0).set_default(0.25).describe(
1285  "Slope coefficient for the negative half axis.");
1286  }
1287 };
1288 
1290 struct PReluAttrs : public tvm::AttrsNode<PReluAttrs> {
1291  int axis;
1292 
1293  TVM_DECLARE_ATTRS(PReluAttrs, "relay.attrs.PReluAttrs") {
1294  TVM_ATTR_FIELD(axis).set_default(1).describe(
1295  "Specify which shape axis the channel is specified.");
1296  }
1297 };
1298 
1300 struct DropoutAttrs : public tvm::AttrsNode<DropoutAttrs> {
1301  double rate;
1302  TVM_DECLARE_ATTRS(DropoutAttrs, "relay.attrs.DropoutAttrs") {
1304  .describe("Fraction of the input that gets dropped out during training time")
1305  .set_default(0.5);
1306  }
1307 }; // struct DropoutAttrs
1308 
1310 struct BatchNormAttrs : public tvm::AttrsNode<BatchNormAttrs> {
1311  int axis;
1312  double epsilon;
1313  bool center;
1314  bool scale;
1315 
1316  TVM_DECLARE_ATTRS(BatchNormAttrs, "relay.attrs.BatchNormAttrs") {
1317  TVM_ATTR_FIELD(axis).describe("Specify which shape axis denotes the channel.").set_default(1);
1319  .describe("Small float added to variance to avoid dividing by zero")
1320  .set_default(1e-5);
1322  .describe("If True, add offset of beta to normalized tensor. If False, beta is ignored")
1323  .set_default(true);
1325  .describe(
1326  "If True, multiply by gamma. If False, gamma is not used. "
1327  "When the next layer is piecewise linear (also, e.g., nn.relu), "
1328  "this can be disabled since the scaling will be done by the next layer.")
1329  .set_default(true);
1330  }
1331 }; // struct BatchNormAttrs
1332 
1334 struct InstanceNormAttrs : public tvm::AttrsNode<InstanceNormAttrs> {
1335  int axis;
1336  double epsilon;
1337  bool center;
1338  bool scale;
1339 
1340  TVM_DECLARE_ATTRS(InstanceNormAttrs, "relay.attrs.InstanceNormAttrs") {
1341  TVM_ATTR_FIELD(axis).describe("Specify which shape axis denotes the channel.").set_default(1);
1343  .describe("Small float added to variance to avoid dividing by zero")
1344  .set_default(1e-5);
1345  TVM_ATTR_FIELD(center).set_default(true).describe(
1346  "If true, add offset of beta to normalized tensor; "
1347  "otherwise, beta is ignored.");
1348  TVM_ATTR_FIELD(scale).set_default(true).describe(
1349  "If true, multiply by gamma; otherwise, gamma is ignored.");
1350  }
1351 }; // struct InstanceNormAttrs
1352 
1354 struct LayerNormAttrs : public tvm::AttrsNode<LayerNormAttrs> {
1355  int axis;
1356  double epsilon;
1357  bool center;
1358  bool scale;
1359 
1360  TVM_DECLARE_ATTRS(LayerNormAttrs, "relay.attrs.LayerNormAttrs") {
1361  TVM_ATTR_FIELD(axis).set_default(-1).describe("Specify which shape axis denotes the channel.");
1362  TVM_ATTR_FIELD(epsilon).set_default(1e-5).describe(
1363  "Small float added to variance to avoid dividing by zero");
1364  TVM_ATTR_FIELD(center).set_default(true).describe(
1365  "If true, add offset of beta to normalized tensor; "
1366  "otherwise, beta is ignored.");
1367  TVM_ATTR_FIELD(scale).set_default(true).describe(
1368  "If true, multiply by gamma; otherwise, gamma is ignored.");
1369  }
1370 }; // struct LayerNormAttrs
1371 
1373 struct GroupNormAttrs : public tvm::AttrsNode<GroupNormAttrs> {
1375  int axis;
1376  double epsilon;
1377  bool center;
1378  bool scale;
1379 
1380  TVM_DECLARE_ATTRS(GroupNormAttrs, "relay.attrs.GroupNormAttrs") {
1382  .set_default(0)
1383  .describe("Specify number of groups to separate the channels into.");
1384  TVM_ATTR_FIELD(axis).set_default(1).describe("Specify which shape axis denotes the channel.");
1385  TVM_ATTR_FIELD(epsilon).set_default(1e-5).describe(
1386  "Small float added to variance to avoid dividing by zero");
1387  TVM_ATTR_FIELD(center).set_default(true).describe(
1388  "If true, add offset of beta to normalized tensor; "
1389  "otherwise, beta is ignored.");
1390  TVM_ATTR_FIELD(scale).set_default(true).describe(
1391  "If true, multiply by gamma; otherwise, gamma is ignored.");
1392  }
1393 }; // struct GroupNormAttrs
1394 
1396 struct LRNAttrs : public tvm::AttrsNode<LRNAttrs> {
1397  int size;
1398  int axis;
1399  double bias;
1400  double alpha;
1401  double beta;
1402 
1403  TVM_DECLARE_ATTRS(LRNAttrs, "relay.attrs.LRNAttrs") {
1404  TVM_ATTR_FIELD(size).set_default(5).describe(
1405  "The size of the local region to be considered for normalization.");
1406  TVM_ATTR_FIELD(axis).set_default(1).describe("Axis of input data layout channel.");
1407  TVM_ATTR_FIELD(bias).set_default(2).describe("The offset parameter to avoid division by 0.");
1408  TVM_ATTR_FIELD(alpha).set_default(0.0001).describe("The scaling parameter.");
1409  TVM_ATTR_FIELD(beta).set_default(0.75).describe("The exponent parameter.");
1410  }
1411 };
1412 
1414 struct L2NormalizeAttrs : public tvm::AttrsNode<L2NormalizeAttrs> {
1415  double eps;
1417 
1418  TVM_DECLARE_ATTRS(L2NormalizeAttrs, "relay.attrs.L2NormalizeAttrs") {
1419  TVM_ATTR_FIELD(eps).describe("A lower bound value for the norm, to avoid division by 0.");
1420  TVM_ATTR_FIELD(axis).describe("Axis over the normalization applied.");
1421  }
1422 };
1423 
1425 struct DeformableConv2DAttrs : public tvm::AttrsNode<DeformableConv2DAttrs> {
1430  int groups;
1433  std::string data_layout;
1434  std::string kernel_layout;
1435  std::string out_layout;
1437 
1438  TVM_DECLARE_ATTRS(DeformableConv2DAttrs, "relay.attrs.DeformableConv2DAttrs") {
1440  .set_default(Array<IndexExpr>({1, 1}))
1441  .describe("Specifies the strides of the convolution.");
1443  .set_default(Array<IndexExpr>({0, 0}))
1444  .describe(
1445  "If padding is non-zero, then the input is implicitly zero-padded"
1446  "Padding support both symmetric and asymmetric as"
1447  "one int : same padding used on all sides"
1448  "two int : bottom, right will use same padding as top, left"
1449  "four int : padding width in the order of (top, left, bottom, right)");
1451  .set_default(Array<IndexExpr>({1, 1}))
1452  .describe("Specifies the dilation rate to use for dilated convolution.");
1454  .set_default(1)
1455  .describe(
1456  "Controls the connections between inputs and offsets."
1457  "Input channels are partitioned into multiple deformable groups. Offsets"
1458  "are shared across input channels in the same deformable group.");
1459  TVM_ATTR_FIELD(groups).set_default(1).describe(
1460  "Controls the connections between inputs and outputs."
1461  "At groups=1, all inputs are convolved to all outputs."
1462  "At groups=2, the operation becomes equivalent to having two convolution"
1463  "layers side by side, each seeing half the input channels, and producing"
1464  "half the output channels, and both subsequently concatenated.");
1466  .describe(
1467  "The number of output channels in the convolution."
1468  " If it is not set, inferred by shape of the weight.")
1469  .set_default(NullValue<IndexExpr>());
1471  .describe("Specifies the dimensions of the convolution window.")
1472  .set_default(NullValue<Array<IndexExpr>>());
1474  .set_default("NCHW")
1475  .describe(
1476  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
1477  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1478  "dimensions respectively. Convolution is applied on the 'H' and"
1479  "'W' dimensions.");
1481  .set_default("OIHW")
1482  .describe(
1483  "Dimension ordering of weight. Can be 'OIHW', 'OIHW16o16i', etc."
1484  "'O', 'I', 'H', 'W' stands for num_filter, input_channel, height, and width"
1485  "dimensions respectively.");
1487  .set_default("")
1488  .describe(
1489  "Dimension ordering of output. Can be 'NCHW', 'NHWC', etc."
1490  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1491  "dimensions respectively. Default to be same as input layout.");
1492 
1493  // use 0 bits to indicate none.
1495  .set_default(NullValue<DataType>())
1496  .describe("Output data type, set to explicit type under mixed precision setting");
1497  }
1498 };
1499 
1501 struct SubPixelAttrs : public tvm::AttrsNode<SubPixelAttrs> {
1503  std::string layout;
1504  std::string mode;
1505 
1506  TVM_DECLARE_ATTRS(SubPixelAttrs, "relay.attrs.SubPixelAttrs") {
1508  .describe("The size of subpixel blocks to compose or decompose.")
1509  .set_default(1);
1510  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
1511  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
1512  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1513  "dimensions respectively.");
1514  TVM_ATTR_FIELD(mode).set_default("DCR").describe(
1515  "Indicates order in which channels are accessed. Must be one of"
1516  "DCR or CDR.");
1517  }
1518 }; // struct SubPixelAttrs
1519 
1521 struct CorrelationAttrs : public tvm::AttrsNode<CorrelationAttrs> {
1524  int stride1;
1525  int stride2;
1529 
1530  TVM_DECLARE_ATTRS(CorrelationAttrs, "relay.attrs.CorrelationAttrs") {
1532  .describe("Kernel size for correlation, must be an odd number.")
1533  .set_default(1);
1534  TVM_ATTR_FIELD(max_displacement).describe("Max displacement of Correlation.").set_default(1);
1535  TVM_ATTR_FIELD(stride1).describe("Stride for data1.").set_default(1);
1536  TVM_ATTR_FIELD(stride2).describe("Stride for data2.").set_default(1);
1538  .describe("Padding for data1 and data2.")
1539  .set_default(Array<IndexExpr>{0, 0});
1541  .describe("Operation type is either multiplication or substraction.")
1542  .set_default(true);
1543  TVM_ATTR_FIELD(layout).set_default("NCHW").describe(
1544  "Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
1545  "'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
1546  "dimensions respectively.");
1547  }
1548 }; // struct CorrelationAttrs
1549 
1551 struct SpaceToBatchNDAttrs : public tvm::AttrsNode<SpaceToBatchNDAttrs> {
1554  double pad_value;
1555 
1556  TVM_DECLARE_ATTRS(SpaceToBatchNDAttrs, "relay.attrs.SpaceToBatchNDAttrs") {
1558  .set_default(Array<Integer>({1, 1}))
1559  .describe("1-D containing block size for each spatial dimension.");
1560  TVM_ATTR_FIELD(paddings).describe("2-D containing paddings for each spatial dimension.");
1561  TVM_ATTR_FIELD(pad_value).set_default(0.0).describe("The value used for padding.");
1562  }
1563 }; // struct SpaceToBatchNDAttrs
1564 
1566 struct BatchToSpaceNDAttrs : public tvm::AttrsNode<BatchToSpaceNDAttrs> {
1569 
1570  TVM_DECLARE_ATTRS(BatchToSpaceNDAttrs, "relay.attrs.BatchToSpaceNDAttrs") {
1572  .set_default(Array<Integer>({1, 1}))
1573  .describe("1-D containing block size for each spatial dimension.");
1574  TVM_ATTR_FIELD(crops).describe("2-D containing amount to crop from spatial dimension.");
1575  }
1576 }; // struct BatchToSpaceNDAttrs
1577 
1579 struct NLLLossAttrs : public tvm::AttrsNode<NLLLossAttrs> {
1580  std::string reduction;
1582 
1583  TVM_DECLARE_ATTRS(NLLLossAttrs, "relay.attrs.NLLLossAttrs") {
1584  TVM_ATTR_FIELD(reduction).set_default("mean").describe(
1585  "The reduction method to apply to the output. Can be"
1586  "'none', 'mean' or 'sum'.");
1587  TVM_ATTR_FIELD(ignore_index).describe("The target value to ignore.");
1588  }
1589 }; // struct NLLLossAttrs
1590 
1591 } // namespace relay
1592 } // namespace tvm
1593 #endif // TVM_RELAY_ATTRS_NN_H_
The base class of the all the Use "curiously recurring template pattern".
Definition: attrs.h:870
Reference to PrimExprNode.
Definition: expr.h:115
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Runtime primitive data type.
Definition: data_type.h:43
Reference to string objects.
Definition: string.h:98
Helpers for attribute objects.
#define TVM_ATTR_FIELD(FieldName)
Declare an attribute field.
Definition: attrs.h:76
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
DataType NullValue< DataType >()
Definition: attrs.h:90
TObjectRef NullValue()
Create a NodeRef type that represents null.
Definition: attrs.h:84
Base classes for the Relay IR.
Attributes for 1d adaptive pool operator.
Definition: nn.h:805
TVM_DECLARE_ATTRS(AdaptivePool1DAttrs, "relay.attrs.AdaptivePool1DAttrs")
Definition: nn.h:810
Array< IndexExpr > output_size
Definition: nn.h:806
tvm::String out_layout
Definition: nn.h:808
std::string layout
Definition: nn.h:807
Attributes for 2d adaptive pool operator.
Definition: nn.h:828
Array< IndexExpr > output_size
Definition: nn.h:829
std::string layout
Definition: nn.h:830
TVM_DECLARE_ATTRS(AdaptivePool2DAttrs, "relay.attrs.AdaptivePool2DAttrs")
Definition: nn.h:833
tvm::String out_layout
Definition: nn.h:831
Attributes for 3d adaptive pool operator.
Definition: nn.h:853
Array< IndexExpr > output_size
Definition: nn.h:854
tvm::String out_layout
Definition: nn.h:856
std::string layout
Definition: nn.h:855
TVM_DECLARE_ATTRS(AdaptivePool3DAttrs, "relay.attrs.AdaptivePool3DAttrs")
Definition: nn.h:858
Attributes for 1D avg pool operator.
Definition: nn.h:918
Array< IndexExpr > strides
Definition: nn.h:920
Array< IndexExpr > pool_size
Definition: nn.h:919
tvm::String out_layout
Definition: nn.h:924
bool count_include_pad
Definition: nn.h:926
Array< IndexExpr > dilation
Definition: nn.h:921
Array< IndexExpr > padding
Definition: nn.h:922
bool ceil_mode
Definition: nn.h:925
TVM_DECLARE_ATTRS(AvgPool1DAttrs, "relay.attrs.AvgPool1DAttrs")
Definition: nn.h:928
std::string layout
Definition: nn.h:923
Attributes for avg pool operator.
Definition: nn.h:737
tvm::String out_layout
Definition: nn.h:743
Array< IndexExpr > dilation
Definition: nn.h:741
tvm::String layout
Definition: nn.h:742
TVM_DECLARE_ATTRS(AvgPool2DAttrs, "relay.attrs.AvgPool2DAttrs")
Definition: nn.h:747
bool ceil_mode
Definition: nn.h:744
Array< IndexExpr > padding
Definition: nn.h:740
bool count_include_pad
Definition: nn.h:745
Array< IndexExpr > strides
Definition: nn.h:739
Array< IndexExpr > pool_size
Definition: nn.h:738
Attributes for 3D avg pool operator.
Definition: nn.h:1005
TVM_DECLARE_ATTRS(AvgPool3DAttrs, "relay.attrs.AvgPool3DAttrs")
Definition: nn.h:1015
Array< IndexExpr > strides
Definition: nn.h:1007
tvm::String out_layout
Definition: nn.h:1011
Array< IndexExpr > pool_size
Definition: nn.h:1006
Array< IndexExpr > dilation
Definition: nn.h:1008
Array< IndexExpr > padding
Definition: nn.h:1009
bool ceil_mode
Definition: nn.h:1012
std::string layout
Definition: nn.h:1010
bool count_include_pad
Definition: nn.h:1013
Attributes for batch matmul operator.
Definition: nn.h:1117
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:1122
bool transpose_b
Definition: nn.h:1120
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:1121
TVM_DECLARE_ATTRS(BatchMatmulAttrs, "relay.attrs.BatchMatmulAttrs")
Definition: nn.h:1124
bool transpose_a
Definition: nn.h:1119
DataType out_dtype
Definition: nn.h:1118
Attributes used in batch_norm operator.
Definition: nn.h:1310
int axis
Definition: nn.h:1311
bool scale
Definition: nn.h:1314
bool center
Definition: nn.h:1313
double epsilon
Definition: nn.h:1312
TVM_DECLARE_ATTRS(BatchNormAttrs, "relay.attrs.BatchNormAttrs")
Definition: nn.h:1316
Attributes used in BatchToSpaceND operator.
Definition: nn.h:1566
TVM_DECLARE_ATTRS(BatchToSpaceNDAttrs, "relay.attrs.BatchToSpaceNDAttrs")
Definition: nn.h:1570
Array< Integer > block_shape
Definition: nn.h:1567
Array< Array< IndexExpr > > crops
Definition: nn.h:1568
Add a 1D Tensor to an axis of a data.
Definition: nn.h:42
TVM_DECLARE_ATTRS(BiasAddAttrs, "relay.attrs.BiasAddAttrs")
Definition: nn.h:45
int axis
Definition: nn.h:43
Attributes used in 1D convolution operators.
Definition: nn.h:51
Array< IndexExpr > strides
Definition: nn.h:52
DataType out_dtype
Definition: nn.h:61
int groups
Definition: nn.h:55
Array< IndexExpr > padding
Definition: nn.h:53
TVM_DECLARE_ATTRS(Conv1DAttrs, "relay.attrs.Conv1DAttrs")
Definition: nn.h:63
tvm::String data_layout
Definition: nn.h:58
tvm::String kernel_layout
Definition: nn.h:59
Array< IndexExpr > dilation
Definition: nn.h:54
Array< IndexExpr > kernel_size
Definition: nn.h:57
IndexExpr channels
Definition: nn.h:56
tvm::String out_layout
Definition: nn.h:60
Attributes used in 1D transposed convolution operator.
Definition: nn.h:624
TVM_DECLARE_ATTRS(Conv1DTransposeAttrs, "relay.attrs.Conv1DTransposeAttrs")
Definition: nn.h:637
std::string out_layout
Definition: nn.h:634
Array< IndexExpr > strides
Definition: nn.h:627
Array< IndexExpr > kernel_size
Definition: nn.h:626
int groups
Definition: nn.h:631
std::string data_layout
Definition: nn.h:632
Array< IndexExpr > output_padding
Definition: nn.h:629
IndexExpr channels
Definition: nn.h:625
Array< IndexExpr > dilation
Definition: nn.h:630
std::string kernel_layout
Definition: nn.h:633
Array< IndexExpr > padding
Definition: nn.h:628
DataType out_dtype
Definition: nn.h:635
Attributes used in convolution operators.
Definition: nn.h:117
DataType out_dtype
Definition: nn.h:129
Array< IndexExpr > dilation
Definition: nn.h:120
tvm::String out_layout
Definition: nn.h:126
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:128
IndexExpr channels
Definition: nn.h:122
Array< IndexExpr > kernel_size
Definition: nn.h:123
Array< IndexExpr > padding
Definition: nn.h:119
TVM_DECLARE_ATTRS(Conv2DAttrs, "relay.attrs.Conv2DAttrs")
Definition: nn.h:131
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:127
tvm::String kernel_layout
Definition: nn.h:125
int groups
Definition: nn.h:121
Array< IndexExpr > strides
Definition: nn.h:118
tvm::String data_layout
Definition: nn.h:124
Attributes used in transposed convolution operator.
Definition: nn.h:535
int groups
Definition: nn.h:542
TVM_DECLARE_ATTRS(Conv2DTransposeAttrs, "relay.attrs.Conv2DTransposeAttrs")
Definition: nn.h:548
Array< IndexExpr > strides
Definition: nn.h:538
Array< IndexExpr > dilation
Definition: nn.h:541
std::string data_layout
Definition: nn.h:543
std::string out_layout
Definition: nn.h:545
Array< IndexExpr > padding
Definition: nn.h:539
IndexExpr channels
Definition: nn.h:536
DataType out_dtype
Definition: nn.h:546
Array< IndexExpr > output_padding
Definition: nn.h:540
std::string kernel_layout
Definition: nn.h:544
Array< IndexExpr > kernel_size
Definition: nn.h:537
Attributes used in convolution operators with winograd algorithm.
Definition: nn.h:212
DataType out_dtype
Definition: nn.h:225
tvm::String kernel_layout
Definition: nn.h:221
Array< IndexExpr > strides
Definition: nn.h:214
tvm::String data_layout
Definition: nn.h:220
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:224
int tile_size
Definition: nn.h:213
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:223
TVM_DECLARE_ATTRS(Conv2DWinogradAttrs, "relay.attrs.Conv2DWinogradAttrs")
Definition: nn.h:227
tvm::String out_layout
Definition: nn.h:222
Array< IndexExpr > kernel_size
Definition: nn.h:219
int groups
Definition: nn.h:217
Array< IndexExpr > dilation
Definition: nn.h:216
IndexExpr channels
Definition: nn.h:218
Array< IndexExpr > padding
Definition: nn.h:215
Attributes used in winograd weight transformation operators.
Definition: nn.h:287
TVM_DECLARE_ATTRS(Conv2DWinogradNNPACKWeightTransformAttrs, "relay.attrs.Conv2DWinogradNNPACKWeightTransformAttrs")
Definition: nn.h:291
Attributes used in convolution operators.
Definition: nn.h:305
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:315
DataType out_dtype
Definition: nn.h:317
Array< IndexExpr > kernel_size
Definition: nn.h:311
tvm::String kernel_layout
Definition: nn.h:313
tvm::String out_layout
Definition: nn.h:314
tvm::String data_layout
Definition: nn.h:312
Array< IndexExpr > strides
Definition: nn.h:306
IndexExpr channels
Definition: nn.h:310
int groups
Definition: nn.h:309
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:316
Array< IndexExpr > padding
Definition: nn.h:307
TVM_DECLARE_ATTRS(Conv3DAttrs, "relay.attrs.Conv3DAttrs")
Definition: nn.h:319
Array< IndexExpr > dilation
Definition: nn.h:308
Attributes used in transposed convolution operator.
Definition: nn.h:377
tvm::String data_layout
Definition: nn.h:385
Array< IndexExpr > strides
Definition: nn.h:380
Array< IndexExpr > output_padding
Definition: nn.h:382
Array< IndexExpr > padding
Definition: nn.h:381
Array< IndexExpr > kernel_size
Definition: nn.h:379
tvm::String kernel_layout
Definition: nn.h:386
int groups
Definition: nn.h:384
TVM_DECLARE_ATTRS(Conv3DTransposeAttrs, "relay.attrs.Conv3DTransposeAttrs")
Definition: nn.h:390
DataType out_dtype
Definition: nn.h:388
Array< IndexExpr > dilation
Definition: nn.h:383
IndexExpr channels
Definition: nn.h:378
tvm::String out_layout
Definition: nn.h:387
Attributes used in 3d winograd convolution operators.
Definition: nn.h:453
int groups
Definition: nn.h:458
TVM_DECLARE_ATTRS(Conv3DWinogradAttrs, "relay.attrs.Conv3DWinogradAttrs")
Definition: nn.h:466
std::string data_layout
Definition: nn.h:461
Array< IndexExpr > dilation
Definition: nn.h:457
std::string kernel_layout
Definition: nn.h:462
DataType out_dtype
Definition: nn.h:464
Array< IndexExpr > kernel_size
Definition: nn.h:460
Array< IndexExpr > padding
Definition: nn.h:456
int tile_size
Definition: nn.h:454
Array< IndexExpr > strides
Definition: nn.h:455
IndexExpr channels
Definition: nn.h:459
std::string out_layout
Definition: nn.h:463
Attributes used in gemm weight transformation operators.
Definition: nn.h:199
TVM_DECLARE_ATTRS(ConvGemmWeightTransformAttrs, "relay.attrs.ConvGemmWeightTransformAttrs")
Definition: nn.h:203
Attributes used in winograd weight transformation operators.
Definition: nn.h:188
TVM_DECLARE_ATTRS(ConvWinogradWeightTransformAttrs, "relay.attrs.ConvWinogradWeightTransformAttrs")
Definition: nn.h:191
Attributes used in correlation operators.
Definition: nn.h:1521
String layout
Definition: nn.h:1528
TVM_DECLARE_ATTRS(CorrelationAttrs, "relay.attrs.CorrelationAttrs")
Definition: nn.h:1530
int kernel_size
Definition: nn.h:1522
int stride2
Definition: nn.h:1525
int stride1
Definition: nn.h:1524
Array< IndexExpr > padding
Definition: nn.h:1526
int max_displacement
Definition: nn.h:1523
bool is_multiply
Definition: nn.h:1527
Attributes for DeformableConv2D operator.
Definition: nn.h:1425
Array< IndexExpr > strides
Definition: nn.h:1426
Array< IndexExpr > padding
Definition: nn.h:1427
Array< IndexExpr > kernel_size
Definition: nn.h:1432
int deformable_groups
Definition: nn.h:1429
DataType out_dtype
Definition: nn.h:1436
std::string out_layout
Definition: nn.h:1435
Array< IndexExpr > dilation
Definition: nn.h:1428
int groups
Definition: nn.h:1430
std::string kernel_layout
Definition: nn.h:1434
IndexExpr channels
Definition: nn.h:1431
TVM_DECLARE_ATTRS(DeformableConv2DAttrs, "relay.attrs.DeformableConv2DAttrs")
Definition: nn.h:1438
std::string data_layout
Definition: nn.h:1433
Attributes for dense operator.
Definition: nn.h:1080
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:1084
IndexExpr units
Definition: nn.h:1081
TVM_DECLARE_ATTRS(DenseAttrs, "relay.attrs.DenseAttrs")
Definition: nn.h:1087
DataType out_dtype
Definition: nn.h:1085
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:1083
Attributes for dense_pack operator.
Definition: nn.h:1098
TVM_DECLARE_ATTRS(DensePackAttrs, "relay.attrs.DensePackAttrs")
Definition: nn.h:1103
tvm::String weight_layout
Definition: nn.h:1101
IndexExpr units
Definition: nn.h:1099
DataType out_dtype
Definition: nn.h:1100
Attributes used in dilate operator.
Definition: nn.h:611
TVM_DECLARE_ATTRS(DilateAttrs, "relay.attrs.DilateAttrs")
Definition: nn.h:615
Array< IndexExpr > strides
Definition: nn.h:612
double dilation_value
Definition: nn.h:613
Attributes used in dropout operator.
Definition: nn.h:1300
double rate
Definition: nn.h:1301
TVM_DECLARE_ATTRS(DropoutAttrs, "relay.attrs.DropoutAttrs")
Definition: nn.h:1302
Attributes for FIFO buffer operator.
Definition: nn.h:1175
TVM_DECLARE_ATTRS(FIFOBufferAttrs, "relay.attrs.FIFOBufferAttrs")
Definition: nn.h:1178
int axis
Definition: nn.h:1176
Attributes for global pool operator.
Definition: nn.h:784
TVM_DECLARE_ATTRS(GlobalPool2DAttrs, "relay.attrs.GlobalPool2DAttrs")
Definition: nn.h:788
tvm::String layout
Definition: nn.h:785
tvm::String out_layout
Definition: nn.h:786
Attributes used in group_norm operator.
Definition: nn.h:1373
TVM_DECLARE_ATTRS(GroupNormAttrs, "relay.attrs.GroupNormAttrs")
Definition: nn.h:1380
int axis
Definition: nn.h:1375
bool scale
Definition: nn.h:1378
int num_groups
Definition: nn.h:1374
double epsilon
Definition: nn.h:1376
bool center
Definition: nn.h:1377
Attributes used in instance_norm operator.
Definition: nn.h:1334
int axis
Definition: nn.h:1335
bool scale
Definition: nn.h:1338
TVM_DECLARE_ATTRS(InstanceNormAttrs, "relay.attrs.InstanceNormAttrs")
Definition: nn.h:1340
double epsilon
Definition: nn.h:1336
bool center
Definition: nn.h:1337
Attributes for L2Normalize operator.
Definition: nn.h:1414
double eps
Definition: nn.h:1415
TVM_DECLARE_ATTRS(L2NormalizeAttrs, "relay.attrs.L2NormalizeAttrs")
Definition: nn.h:1418
Array< Integer > axis
Definition: nn.h:1416
Attributes for LRN operator.
Definition: nn.h:1396
int size
Definition: nn.h:1397
double bias
Definition: nn.h:1399
double beta
Definition: nn.h:1401
double alpha
Definition: nn.h:1400
int axis
Definition: nn.h:1398
TVM_DECLARE_ATTRS(LRNAttrs, "relay.attrs.LRNAttrs")
Definition: nn.h:1403
Attributes used in layer_norm operator.
Definition: nn.h:1354
bool center
Definition: nn.h:1357
double epsilon
Definition: nn.h:1356
TVM_DECLARE_ATTRS(LayerNormAttrs, "relay.attrs.LayerNormAttrs")
Definition: nn.h:1360
int axis
Definition: nn.h:1355
bool scale
Definition: nn.h:1358
Attributes for leaky relu operator.
Definition: nn.h:1280
TVM_DECLARE_ATTRS(LeakyReluAttrs, "relay.attrs.LeakyReluAttrs")
Definition: nn.h:1283
double alpha
Definition: nn.h:1281
Attributes for matmul operator.
Definition: nn.h:1052
DataType out_dtype
Definition: nn.h:1054
tvm::String auto_scheduler_rewritten_layout
Definition: nn.h:1058
bool transpose_a
Definition: nn.h:1055
TVM_DECLARE_ATTRS(MatmulAttrs, "relay.attrs.MatmulAttrs")
Definition: nn.h:1061
IndexExpr units
Definition: nn.h:1053
Array< PrimExpr > meta_schedule_original_shape
Definition: nn.h:1059
bool transpose_b
Definition: nn.h:1056
Attributes for 1D max pool operator.
Definition: nn.h:878
std::string layout
Definition: nn.h:883
Array< IndexExpr > strides
Definition: nn.h:880
Array< IndexExpr > padding
Definition: nn.h:882
bool ceil_mode
Definition: nn.h:885
tvm::String out_layout
Definition: nn.h:884
TVM_DECLARE_ATTRS(MaxPool1DAttrs, "relay.attrs.MaxPool1DAttrs")
Definition: nn.h:887
Array< IndexExpr > pool_size
Definition: nn.h:879
Array< IndexExpr > dilation
Definition: nn.h:881
Attributes for max pool operator.
Definition: nn.h:694
TVM_DECLARE_ATTRS(MaxPool2DAttrs, "relay.attrs.MaxPool2DAttrs")
Definition: nn.h:703
tvm::String out_layout
Definition: nn.h:700
bool ceil_mode
Definition: nn.h:701
Array< IndexExpr > strides
Definition: nn.h:696
tvm::String layout
Definition: nn.h:699
Array< IndexExpr > pool_size
Definition: nn.h:695
Array< IndexExpr > padding
Definition: nn.h:697
Array< IndexExpr > dilation
Definition: nn.h:698
Attributes for 3D max pool operator.
Definition: nn.h:962
TVM_DECLARE_ATTRS(MaxPool3DAttrs, "relay.attrs.MaxPool3DAttrs")
Definition: nn.h:971
Array< IndexExpr > dilation
Definition: nn.h:965
bool ceil_mode
Definition: nn.h:969
std::string layout
Definition: nn.h:967
Array< IndexExpr > pool_size
Definition: nn.h:963
Array< IndexExpr > strides
Definition: nn.h:964
tvm::String out_layout
Definition: nn.h:968
Array< IndexExpr > padding
Definition: nn.h:966
Attributes used for the MirrorPadding operator.
Definition: nn.h:1265
TVM_DECLARE_ATTRS(MirrorPadAttrs, "relay.attrs.MirrorPadAttrs")
Definition: nn.h:1269
Array< Array< IndexExpr > > pad_width
Definition: nn.h:1267
std::string mode
Definition: nn.h:1266
Attributes used in NLLLoss operator.
Definition: nn.h:1579
std::string reduction
Definition: nn.h:1580
TVM_DECLARE_ATTRS(NLLLossAttrs, "relay.attrs.NLLLossAttrs")
Definition: nn.h:1583
int ignore_index
Definition: nn.h:1581
Attributes for prelu operator.
Definition: nn.h:1290
int axis
Definition: nn.h:1291
TVM_DECLARE_ATTRS(PReluAttrs, "relay.attrs.PReluAttrs")
Definition: nn.h:1293
Attributes used for the padding operator.
Definition: nn.h:1247
tvm::String pad_mode
Definition: nn.h:1249
TVM_DECLARE_ATTRS(PadAttrs, "relay.attrs.PadAttrs")
Definition: nn.h:1251
Array< Array< Integer > > pad_width
Definition: nn.h:1248
Attributes used in softmax operators.
Definition: nn.h:526
int axis
Definition: nn.h:527
TVM_DECLARE_ATTRS(SoftmaxAttrs, "relay.attrs.SoftmaxAttrs")
Definition: nn.h:529
Attributes used in SpaceToBatchND operator.
Definition: nn.h:1551
TVM_DECLARE_ATTRS(SpaceToBatchNDAttrs, "relay.attrs.SpaceToBatchNDAttrs")
Definition: nn.h:1556
double pad_value
Definition: nn.h:1554
Array< Integer > block_shape
Definition: nn.h:1552
Array< Array< IndexExpr > > paddings
Definition: nn.h:1553
Attributes for sparse_dense operator.
Definition: nn.h:1159
Array< IndexExpr > kernel_size
Definition: nn.h:1161
std::string layout
Definition: nn.h:1160
TVM_DECLARE_ATTRS(SparseConv2DAttrs, "relay.attrs.SparseConv2DAttrs")
Definition: nn.h:1163
Attributes for sparse_dense operator.
Definition: nn.h:1141
TVM_DECLARE_ATTRS(SparseDenseAttrs, "relay.attrs.SparseDenseAttrs")
Definition: nn.h:1144
bool sparse_lhs
Definition: nn.h:1142
Attributes for sparse_transpose operator.
Definition: nn.h:1154
TVM_DECLARE_ATTRS(SparseTransposeAttrs, "relay.attrs.SparseTransposeAttrs")
Definition: nn.h:1155
Attributes used in subpixel operators.
Definition: nn.h:1501
int block_size
Definition: nn.h:1502
std::string layout
Definition: nn.h:1503
TVM_DECLARE_ATTRS(SubPixelAttrs, "relay.attrs.SubPixelAttrs")
Definition: nn.h:1506
std::string mode
Definition: nn.h:1504
Attributes for upsampling3d operator.
Definition: nn.h:1213
TVM_DECLARE_ATTRS(UpSampling3DAttrs, "relay.attrs.UpSampling3DAttrs")
Definition: nn.h:1221
double scale_w
Definition: nn.h:1216
double scale_d
Definition: nn.h:1214
std::string method
Definition: nn.h:1218
double scale_h
Definition: nn.h:1215
std::string coordinate_transformation_mode
Definition: nn.h:1219
std::string layout
Definition: nn.h:1217
Attributes for upsampling operator.
Definition: nn.h:1184
double scale_h
Definition: nn.h:1185
bool align_corners
Definition: nn.h:1189
TVM_DECLARE_ATTRS(UpSamplingAttrs, "relay.attrs.UpSamplingAttrs")
Definition: nn.h:1191
tvm::String method
Definition: nn.h:1188
tvm::String layout
Definition: nn.h:1187
double scale_w
Definition: nn.h:1186