@@ -456,6 +456,67 @@ struct L2NormalizeAttrs : public tvm::AttrsNode<L2NormalizeAttrs> {
456456 }
457457};
458458
459+
460+ /* ! \brief Attributes for DeformableConv2D operator */
461+ struct DeformableConv2DAttrs : public tvm ::AttrsNode<DeformableConv2DAttrs> {
462+ Array<IndexExpr> strides;
463+ Array<IndexExpr> padding;
464+ Array<IndexExpr> dilation;
465+ int deformable_groups;
466+ int groups;
467+ IndexExpr channels;
468+ Array<IndexExpr> kernel_size;
469+ std::string data_layout;
470+ std::string kernel_layout;
471+ std::string out_layout;
472+ DataType out_dtype;
473+
474+ TVM_DECLARE_ATTRS (DeformableConv2DAttrs, " relay.attrs.DeformableConv2DAttrs" ) {
475+ TVM_ATTR_FIELD (strides).set_default (Array<IndexExpr>({1 , 1 }))
476+ .describe (" Specifies the strides of the convolution." );
477+ TVM_ATTR_FIELD (padding).set_default (Array<IndexExpr>({0 , 0 }))
478+ .describe (" If padding is non-zero, then the input is implicitly zero-padded"
479+ " on both sides for padding number of points" );
480+ TVM_ATTR_FIELD (dilation).set_default (Array<IndexExpr>({1 , 1 }))
481+ .describe (" Specifies the dilation rate to use for dilated convolution." );
482+ TVM_ATTR_FIELD (deformable_groups).set_default (1 )
483+ .describe (" Controls the connections between inputs and offsets."
484+ " Input channels are partitioned into multiple deformable groups. Offsets"
485+ " are shared across input channels in the same deformable group." );
486+ TVM_ATTR_FIELD (groups).set_default (1 )
487+ .describe (" Controls the connections between inputs and outputs."
488+ " At groups=1, all inputs are convolved to all outputs."
489+ " At groups=2, the operation becomes equivalent to having two convolution"
490+ " layers side by side, each seeing half the input channels, and producing"
491+ " half the output channels, and both subsequently concatenated." );
492+ TVM_ATTR_FIELD (channels)
493+ .describe (" The number of output channels in the convolution."
494+ " If it is not set, inferred by shape of the weight." )
495+ .set_default (NullValue<IndexExpr>());
496+ TVM_ATTR_FIELD (kernel_size)
497+ .describe (" Specifies the dimensions of the convolution window." )
498+ .set_default (NullValue<Array<IndexExpr> >());
499+ TVM_ATTR_FIELD (data_layout).set_default (" NCHW" )
500+ .describe (" Dimension ordering of input data. Can be 'NCHW', 'NHWC', etc."
501+ " 'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
502+ " dimensions respectively. Convolution is applied on the 'H' and"
503+ " 'W' dimensions." );
504+ TVM_ATTR_FIELD (kernel_layout).set_default (" OIHW" )
505+ .describe (" Dimension ordering of weight. Can be 'OIHW', 'OIHW16o16i', etc."
506+ " 'O', 'I', 'H', 'W' stands for num_filter, input_channel, height, and width"
507+ " dimensions respectively." );
508+ TVM_ATTR_FIELD (out_layout).set_default (" " )
509+ .describe (" Dimension ordering of output. Can be 'NCHW', 'NHWC', etc."
510+ " 'N', 'C', 'H', 'W' stands for batch, channel, height, and width"
511+ " dimensions respectively. Default to be same as input layout." );
512+
513+ // use 0 bits to indicate none.
514+ TVM_ATTR_FIELD (out_dtype)
515+ .set_default (NullValue<DataType>())
516+ .describe (" Output data type, set to explicit type under mixed precision setting" );
517+ }
518+ };
519+
459520} // namespace relay
460521} // namespace tvm
461522#endif // TVM_RELAY_ATTRS_NN_H_
0 commit comments