Hi @oldriver-wang
It seems that the current PyTorch API doesn’t support 3D affine transformation. Up to now, affine_grid()  and grid_sample() can only support 2D affine transformation (especially, 2D perspective transformation is not supported yet).
As the advices from @HectorAnadon, to implement complicated geometric transformations, you can try Kornia 14.