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