@@ -1043,6 +1043,59 @@ def avg_pool3d(
10431043 )
10441044
10451045
1046+ def adaptive_avg_pool1d (
1047+ data : Expr ,
1048+ output_size : Optional [Union [int , Tuple [int ]]] = None ,
1049+ layout : str = "NCW" ,
1050+ out_layout : Optional [str ] = None ,
1051+ ) -> Expr :
1052+ r"""1D adaptive average pooling operator. This operator is experimental.
1053+
1054+ This operator takes data as input and does 1D average value calculation
1055+ across each window represented by W.
1056+
1057+
1058+ In the default case, where the data_layout is `NCW`
1059+ a data Tensor with shape `(batch_size, in_channels, width)`,
1060+ to produce an output Tensor with shape
1061+ (batch_size, in_channels, output_width).
1062+
1063+ The pooling kernel and stride sizes are automatically chosen for
1064+ desired output sizes.
1065+
1066+ For output_size:
1067+ If this argument is not provided, input height and width will be used
1068+ as output width.
1069+
1070+ If a single integer is provided for output_size, the output size is
1071+ (N x C x output_size) for any input (NCW).
1072+
1073+ Parameters
1074+ ----------
1075+ data : relax.Expr
1076+ The input data to the operator.
1077+
1078+ output_size : Optional[Union[int, Tuple[int, int]]]
1079+ Output height and width.
1080+ If not specified, it will be the same as the input height and width.
1081+ If specified, it is required to have length either 1 or 2.
1082+
1083+ layout : str
1084+ Layout of the input.
1085+
1086+ out_layout : Optional[str]
1087+ Layout of the output. If not specified, it is the same as data_layout
1088+
1089+ Returns
1090+ -------
1091+ result : relax.Expr
1092+ The computed result.
1093+ """
1094+ if isinstance (output_size , int ):
1095+ output_size = (output_size ,)
1096+ return _ffi_api .adaptive_avg_pool1d (data , output_size , layout , out_layout ) # type: ignore
1097+
1098+
10461099def adaptive_avg_pool2d (
10471100 data : Expr ,
10481101 output_size : Optional [Union [int , Tuple [int , int ]]] = None ,
@@ -1099,6 +1152,62 @@ def adaptive_avg_pool2d(
10991152 return _ffi_api .adaptive_avg_pool2d (data , output_size , layout , out_layout ) # type: ignore
11001153
11011154
1155+ def adaptive_avg_pool3d (
1156+ data : Expr ,
1157+ output_size : Optional [Union [int , Tuple [int , int ]]] = None ,
1158+ layout : str = "NCDHW" ,
1159+ out_layout : Optional [str ] = None ,
1160+ ) -> Expr :
1161+ r"""3D adaptive average pooling operator. This operator is experimental.
1162+
1163+ This operator takes data as input and does 3D average value calculation
1164+ across each window represented by WxH.
1165+
1166+
1167+ In the default case, where the data_layout is `NCDHW`
1168+ a data Tensor with shape `(batch_size, in_channels, depth, height, width)`,
1169+ to produce an output Tensor with shape
1170+ (batch_size, in_channels, output_depth, output_height, output_width).
1171+
1172+ The pooling kernel and stride sizes are automatically chosen for
1173+ desired output sizes.
1174+
1175+ For output_size:
1176+ If this argument is not provided, input depth, height and width will be used
1177+ as output depth, height and width.
1178+
1179+ If a single integer is provided for output_size, the output size is
1180+ (N x C x output_size x output_size x output_size) for any input (NCDHW).
1181+
1182+ If a tuple of integers (depth, height, width) are provided for output_size,
1183+ the output size is (N x C x depth x height x width) for any input (NCDHW).
1184+
1185+ Parameters
1186+ ----------
1187+ data : relax.Expr
1188+ The input data to the operator.
1189+
1190+ output_size : Optional[Union[int, Tuple[int, int]]]
1191+ Output height and width.
1192+ If not specified, it will be the same as the input height and width.
1193+ If specified, it is required to have length either 1 or 3.
1194+
1195+ layout : str
1196+ Layout of the input.
1197+
1198+ out_layout : Optional[str]
1199+ Layout of the output. If not specified, it is the same as data_layout
1200+
1201+ Returns
1202+ -------
1203+ result : relax.Expr
1204+ The computed result.
1205+ """
1206+ if isinstance (output_size , int ):
1207+ output_size = (output_size , output_size , output_size )
1208+ return _ffi_api .adaptive_avg_pool3d (data , output_size , layout , out_layout ) # type: ignore
1209+
1210+
11021211def relu (data : Expr ) -> Expr :
11031212 r"""Rectified linear unit.
11041213
0 commit comments