Could you provide more information about how you’re calling affine_grid? The documentation 20 suggests that the first argument should have size (N, 2, 3) and the second argument should be 4-dimensional with size (N, C, H, W).