Skip to content

Commit 5d68680

Browse files
jerryzh168facebook-github-bot
authored andcommitted
Remove redundant quant/dequant in GenrealizedRCNN
Summary: Removed quant/dequant between backbone and proposal generator, and roi_box_conv and the following avg_pool Reviewed By: wat3rBro Differential Revision: D29383036 fbshipit-source-id: ef07b3d1997b1fc7f92bcd9201523e9071510a8b
1 parent c5eb1f7 commit 5d68680

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

detectron2/export/c10.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,12 @@ def forward(self, x, box_lists):
299299
c2_roi_align = torch.ops._caffe2.RoIAlign
300300
aligned = self.level_poolers[0].aligned
301301

302+
x0 = x[0]
303+
if x0.is_quantized:
304+
x0 = x0.dequantize()
305+
302306
out = c2_roi_align(
303-
x[0],
307+
x0,
304308
pooler_fmt_boxes,
305309
order="NCHW",
306310
spatial_scale=float(self.level_poolers[0].spatial_scale),
@@ -337,6 +341,9 @@ def forward(self, x, box_lists):
337341
c2_roi_align = torch.ops._caffe2.RoIAlign
338342
aligned = bool(pooler.aligned)
339343

344+
if x_level.is_quantized:
345+
x_level = x_level.dequantize()
346+
340347
roi_feat_fpn = c2_roi_align(
341348
x_level,
342349
roi_fpn,

0 commit comments

Comments
 (0)