Skip to content

Commit dfea77e

Browse files
hyunjaelee410ruotianluo
authored andcommitted
fixed shape error in network.py
1 parent 57c92ad commit dfea77e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/nets/network.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def _crop_pool_layer(self, bottom, rois, max_pool=True):
114114

115115
# affine theta
116116
theta = Variable(rois.data.new(rois.size(0), 2, 3).zero_())
117-
theta[:, 0, 0] = (x2 - x1) / (width - 1)
118-
theta[:, 0 ,2] = (x1 + x2 - width + 1) / (width - 1)
119-
theta[:, 1, 1] = (y2 - y1) / (height - 1)
120-
theta[:, 1, 2] = (y1 + y2 - height + 1) / (height - 1)
117+
theta[:, 0, 0] = ((x2 - x1) / (width - 1)).view(rois.size(0))
118+
theta[:, 0 ,2] = ((x1 + x2 - width + 1) / (width - 1)).view(rois.size(0))
119+
theta[:, 1, 1] = ((y2 - y1) / (height - 1)).view(rois.size(0))
120+
theta[:, 1, 2] = ((y1 + y2 - height + 1) / (height - 1)).view(rois.size(0))
121121

122122
pre_pool_size = cfg.POOLING_SIZE * 2 if max_pool else cfg.POOLING_SIZE
123123
grid = F.affine_grid(theta, torch.Size((rois.size(0), 1, pre_pool_size, pre_pool_size)))

0 commit comments

Comments
 (0)