@@ -62,11 +62,11 @@ __global__ void affine_grid_kernel(const int count, int n, int out_h, int out_w,
62
62
63
63
int theta_offset = n * 6 ; // 2 * 3;
64
64
// affine from (h_coor, w_coor) to (x, y)
65
- output[index * 2 ] = theta[theta_offset] * h_coor +
66
- theta[theta_offset + 1 ] * w_coor +
65
+ output[index * 2 ] = theta[theta_offset] * w_coor +
66
+ theta[theta_offset + 1 ] * h_coor +
67
67
theta[theta_offset + 2 ];
68
- output[index * 2 + 1 ] = theta[theta_offset + 3 ] * h_coor +
69
- theta[theta_offset + 4 ] * w_coor +
68
+ output[index * 2 + 1 ] = theta[theta_offset + 3 ] * w_coor +
69
+ theta[theta_offset + 4 ] * h_coor +
70
70
theta[theta_offset + 5 ];
71
71
}
72
72
}
@@ -86,13 +86,13 @@ __global__ void affine_grid_grad_kernel(const int count, int n, int out_h,
86
86
87
87
int theta_offset = n * 6 ; // 2 * 3;
88
88
T out_grad_x = out_grad[index * 2 ];
89
- platform::CudaAtomicAdd (theta_grad + theta_offset, out_grad_x * h_coor );
90
- platform::CudaAtomicAdd (theta_grad + theta_offset + 1 , out_grad_x * w_coor );
89
+ platform::CudaAtomicAdd (theta_grad + theta_offset, out_grad_x * w_coor );
90
+ platform::CudaAtomicAdd (theta_grad + theta_offset + 1 , out_grad_x * h_coor );
91
91
platform::CudaAtomicAdd (theta_grad + theta_offset + 2 , out_grad_x);
92
92
93
93
T out_grad_y = out_grad[index * 2 + 1 ];
94
- platform::CudaAtomicAdd (theta_grad + theta_offset + 3 , out_grad_y * h_coor );
95
- platform::CudaAtomicAdd (theta_grad + theta_offset + 4 , out_grad_y * w_coor );
94
+ platform::CudaAtomicAdd (theta_grad + theta_offset + 3 , out_grad_y * w_coor );
95
+ platform::CudaAtomicAdd (theta_grad + theta_offset + 4 , out_grad_y * h_coor );
96
96
platform::CudaAtomicAdd (theta_grad + theta_offset + 5 , out_grad_y);
97
97
}
98
98
}
0 commit comments