@@ -162,13 +162,11 @@ func.func @torch.aten.fake_quantize_per_tensor_affine(%input: !torch.vtensor<[1,
162
162
// CHECK-LABEL: func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams(
163
163
// CHECK-SAME: %[[ARG0:.*]]: !torch.vtensor<[1,64,32,32],f32>) -> !torch.vtensor<[1,64,32,32],f32>
164
164
// CHECK: %[[T0:.*]] = torch_c.to_builtin_tensor %[[ARG0]] : !torch.vtensor<[1,64,32,32],f32> -> tensor<1x64x32x32xf32>
165
- // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_tensor_affine.tensor_qparams") %[[T0]] {
165
+ // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_tensor_affine.tensor_qparams") %[[T0]], %{{.*}}, %{{.*}} {
166
166
// CHECK-SAME: quant_max = 255 : i64,
167
167
// CHECK-SAME: quant_min = 0 : i64,
168
- // CHECK-SAME: scale = array<f64: 0.039370078593492508>,
169
- // CHECK-SAME: torch_operand_names = ["self"],
170
- // CHECK-SAME: zero_point = array<i64: 2>}
171
- // CHECK-SAME: tensor<1x64x32x32xf32> -> tensor<1x64x32x32xf32>
168
+ // CHECK-SAME: torch_operand_names = ["self", "scale", "zero_point"]} :
169
+ // CHECK-SAME: tensor<1x64x32x32xf32>, tensor<1xf32>, tensor<1xi32> -> tensor<1x64x32x32xf32>
172
170
// CHECK: %[[RES:.*]] = torch_c.from_builtin_tensor %[[CUSTOM]] : tensor<1x64x32x32xf32> -> !torch.vtensor<[1,64,32,32],f32>
173
171
// CHECK: return %[[RES]] : !torch.vtensor<[1,64,32,32],f32>
174
172
func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams (%input: !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >) -> !torch.vtensor <[1 ,64 ,32 ,32 ],f32 > {
@@ -185,13 +183,11 @@ func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams(%input: !to
185
183
// CHECK-LABEL: func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams_zero(
186
184
// CHECK-SAME: %[[ARG0:.*]]: !torch.vtensor<[1,64,32,32],f32>) -> !torch.vtensor<[1,64,32,32],f32>
187
185
// CHECK: %[[T0:.*]] = torch_c.to_builtin_tensor %[[ARG0]] : !torch.vtensor<[1,64,32,32],f32> -> tensor<1x64x32x32xf32>
188
- // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_tensor_affine.tensor_qparams") %[[T0]] {
186
+ // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_tensor_affine.tensor_qparams") %[[T0]], %{{.*}}, %{{.*}} {
189
187
// CHECK-SAME: quant_max = 255 : i64,
190
188
// CHECK-SAME: quant_min = 0 : i64,
191
- // CHECK-SAME: scale = array<f64: 0.039370078593492508>,
192
- // CHECK-SAME: torch_operand_names = ["self"],
193
- // CHECK-SAME: zero_point = array<i64: 0>}
194
- // CHECK-SAME: tensor<1x64x32x32xf32> -> tensor<1x64x32x32xf32>
189
+ // CHECK-SAME: torch_operand_names = ["self", "scale", "zero_point"]} :
190
+ // CHECK-SAME: tensor<1x64x32x32xf32>, tensor<1xf32>, tensor<1xi32> -> tensor<1x64x32x32xf32>
195
191
// CHECK: %[[RES:.*]] = torch_c.from_builtin_tensor %[[CUSTOM]] : tensor<1x64x32x32xf32> -> !torch.vtensor<[1,64,32,32],f32>
196
192
// CHECK: return %[[RES]] : !torch.vtensor<[1,64,32,32],f32>
197
193
func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams_zero (%input: !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >) -> !torch.vtensor <[1 ,64 ,32 ,32 ],f32 > {
@@ -202,10 +198,10 @@ func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams_zero(%input
202
198
%5 = torch.prim.ListConstruct %int1 : (!torch.int ) -> !torch.list <int >
203
199
%cuda3A0 = torch.constant.device " cuda:0"
204
200
%false = torch.constant.bool false
205
- %zero_point = torch.aten.zeros %5 , %int3 , %none , %cuda3A0 , %false : !torch.list <int >, !torch.int , !torch.none , !torch.Device , !torch.bool -> !torch.tensor
201
+ %zero_point = torch.aten.zeros %5 , %int3 , %none , %cuda3A0 , %false : !torch.list <int >, !torch.int , !torch.none , !torch.Device , !torch.bool -> !torch.vtensor <[ 1 ], si32 >
206
202
%int0 = torch.constant.int 0
207
203
%int255 = torch.constant.int 255
208
- %output = torch.aten.fake_quantize_per_tensor_affine.tensor_qparams %input , %scale , %zero_point , %int0 , %int255 : !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >, !torch.vtensor <[1 ],f32 >, !torch.tensor , !torch.int , !torch.int -> !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >
204
+ %output = torch.aten.fake_quantize_per_tensor_affine.tensor_qparams %input , %scale , %zero_point , %int0 , %int255 : !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >, !torch.vtensor <[1 ],f32 >, !torch.vtensor <[ 1 ], si32 > , !torch.int , !torch.int -> !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >
209
205
return %output : !torch.vtensor <[1 ,64 ,32 ,32 ],f32 >
210
206
}
211
207
@@ -214,14 +210,12 @@ func.func @torch.aten.fake_quantize_per_tensor_affine.tensor_qparams_zero(%input
214
210
// CHECK-LABEL: func.func @torch.aten.fake_quantize_per_channel_affine(
215
211
// CHECK-SAME: %[[ARG0:.*]]: !torch.vtensor<[1,3,32,32],f32>) -> !torch.vtensor<[1,3,32,32],f32>
216
212
// CHECK: %[[T0:.*]] = torch_c.to_builtin_tensor %[[ARG0]] : !torch.vtensor<[1,3,32,32],f32> -> tensor<1x3x32x32xf32>
217
- // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_channel_affine") %[[T0]] {
213
+ // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_channel_affine") %[[T0]], %{{.*}}, %{{.*}} {
218
214
// CHECK-SAME: axis = 1 : i64,
219
215
// CHECK-SAME: quant_max = 255 : i64,
220
216
// CHECK-SAME: quant_min = 0 : i64,
221
- // CHECK-SAME: scale = array<f64: 0.039370078593492508, 0.039370078593492508, 0.039370078593492508>,
222
- // CHECK-SAME: torch_operand_names = ["self"],
223
- // CHECK-SAME: zero_point = array<i64: 2, 2, 2>}
224
- // CHECK-SAME: tensor<1x3x32x32xf32> -> tensor<1x3x32x32xf32>
217
+ // CHECK-SAME: torch_operand_names = ["self", "scale", "zero_point"]} :
218
+ // CHECK-SAME: tensor<1x3x32x32xf32>, tensor<3xf32>, tensor<3xi32> -> tensor<1x3x32x32xf32>
225
219
// CHECK: %[[RES:.*]] = torch_c.from_builtin_tensor %[[CUSTOM]] : tensor<1x3x32x32xf32> -> !torch.vtensor<[1,3,32,32],f32>
226
220
// CHECK: return %[[RES]] : !torch.vtensor<[1,3,32,32],f32>
227
221
func.func @torch.aten.fake_quantize_per_channel_affine (%input: !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >) -> !torch.vtensor <[1 ,3 ,32 ,32 ],f32 > {
@@ -239,14 +233,12 @@ func.func @torch.aten.fake_quantize_per_channel_affine(%input: !torch.vtensor<[1
239
233
// CHECK-LABEL: func.func @torch.aten.fake_quantize_per_channel_affine_zero_like(
240
234
// CHECK-SAME: %[[ARG0:.*]]: !torch.vtensor<[1,3,32,32],f32>) -> !torch.vtensor<[1,3,32,32],f32>
241
235
// CHECK: %[[T0:.*]] = torch_c.to_builtin_tensor %[[ARG0]] : !torch.vtensor<[1,3,32,32],f32> -> tensor<1x3x32x32xf32>
242
- // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_channel_affine") %[[T0]] {
236
+ // CHECK: %[[CUSTOM:.*]] = tcp.custom_op("torch.aten.fake_quantize_per_channel_affine") %[[T0]], %{{.*}}, %{{.*}} {
243
237
// CHECK-SAME: axis = 1 : i64,
244
238
// CHECK-SAME: quant_max = 255 : i64,
245
239
// CHECK-SAME: quant_min = 0 : i64,
246
- // CHECK-SAME: scale = array<f64: 0.039370078593492508, 0.039370078593492508, 0.039370078593492508>,
247
- // CHECK-SAME: torch_operand_names = ["self"],
248
- // CHECK-SAME: zero_point = array<i64: 0, 0, 0>}
249
- // CHECK-SAME: tensor<1x3x32x32xf32> -> tensor<1x3x32x32xf32>
240
+ // CHECK-SAME: torch_operand_names = ["self", "scale", "zero_point"]} :
241
+ // CHECK-SAME: tensor<1x3x32x32xf32>, tensor<3xf32>, tensor<3xi32> -> tensor<1x3x32x32xf32>
250
242
// CHECK: %[[RES:.*]] = torch_c.from_builtin_tensor %[[CUSTOM]] : tensor<1x3x32x32xf32> -> !torch.vtensor<[1,3,32,32],f32>
251
243
// CHECK: return %[[RES]] : !torch.vtensor<[1,3,32,32],f32>
252
244
func.func @torch.aten.fake_quantize_per_channel_affine_zero_like (%input: !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >) -> !torch.vtensor <[1 ,3 ,32 ,32 ],f32 > {
@@ -258,7 +250,7 @@ func.func @torch.aten.fake_quantize_per_channel_affine_zero_like(%input: !torch.
258
250
%none = torch.constant.none
259
251
%cuda3A0 = torch.constant.device " cuda:0"
260
252
%false = torch.constant.bool false
261
- %zero_point = torch.aten.zeros_like %scale , %int3 , %none , %cuda3A0 , %false , %none : !torch.vtensor <[3 ],f32 >, !torch.int , !torch.none , !torch.Device , !torch.bool , !torch.none -> !torch.tensor
262
- %output = torch.aten.fake_quantize_per_channel_affine %input , %scale , %zero_point , %int1 , %int0 , %int255 : !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >, !torch.vtensor <[3 ],f32 >, !torch.tensor , !torch.int , !torch.int , !torch.int -> !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >
253
+ %zero_point = torch.aten.zeros_like %scale , %int3 , %none , %cuda3A0 , %false , %none : !torch.vtensor <[3 ],f32 >, !torch.int , !torch.none , !torch.Device , !torch.bool , !torch.none -> !torch.vtensor <[ 3 ], si32 >
254
+ %output = torch.aten.fake_quantize_per_channel_affine %input , %scale , %zero_point , %int1 , %int0 , %int255 : !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >, !torch.vtensor <[3 ],f32 >, !torch.vtensor <[ 3 ], si32 > , !torch.int , !torch.int , !torch.int -> !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >
263
255
return %output : !torch.vtensor <[1 ,3 ,32 ,32 ],f32 >
264
256
}
0 commit comments