@ruotianluo
Thanks! I have a few questions. First, why are you dividing by 16 in   x1 = rois[:, 1::4] / 16.0. Second, I’m conceptually confused by:
 theta[:, 0, 0] = (x2 - x1) / (width - 1)
 theta[:, 0 ,2] = (x1 + x2 - width + 1) / (width - 1)
 theta[:, 1, 1] = (y2 - y1) / (height - 1)
 theta[:, 1, 2] = (y1 + y2 - height + 1) / (height - 1)

What is this calculating? I assume it’s x,y, width and height? And if so, why do you pass it to F.affine_grid? These don’t seem to be angles which you would want to transform bottom? (what is bottom?)
Thanks!