@@ -17,6 +17,7 @@ def forward(self, x, offset):
1717 ks = self .kernel_size
1818 N = offset .size (1 ) // 2
1919
20+ # Change offset's order from [x1, x2, ..., y1, y2, ...] to [x1, y1, x2, y2, ...]
2021 # Codes below are written to make sure same results of MXNet implementation.
2122 # You can remove them, and it won't influence the module's performance.
2223 offsets_index = Variable (torch .cat ([torch .arange (0 , 2 * N , 2 ), torch .arange (1 , 2 * N + 1 , 2 )]), requires_grad = False ).type_as (x ).long ()
@@ -74,7 +75,7 @@ def forward(self, x, offset):
7475 def _get_p_n (self , N , dtype ):
7576 p_n_x , p_n_y = np .meshgrid (range (- (self .kernel_size - 1 )// 2 , (self .kernel_size - 1 )// 2 + 1 ),
7677 range (- (self .kernel_size - 1 )// 2 , (self .kernel_size - 1 )// 2 + 1 ), indexing = 'ij' )
77- # (2N, 1), order[x1, x2, ..., y1, y2, ...]
78+ # (2N, 1)
7879 p_n = np .concatenate ((p_n_x .flatten (), p_n_y .flatten ()))
7980 p_n = np .reshape (p_n , (1 , 2 * N , 1 , 1 ))
8081 p_n = Variable (torch .from_numpy (p_n ).type (dtype ), requires_grad = False )
0 commit comments