I’m using affine transformation to generate a transformation grid. I would like to be able to interpret the output of affine grid.
input_data = torch.arange(25).reshape(1, 1, 5, 5).double()
identity_theta = torch.tensor((1,0,0,0,1,0)).reshape(2,3).double()
identity_grid = torch.nn.functional.affine_grid(identity_theta.unsqueeze(0), input_data.shape)
output_data = torch.nn.functional.grid_sample(input_data, identity_grid)

print(identity_grid)
print()
print(output_data)

The output is:
tensor([[[[-0.8000, -0.8000],
          [-0.4000, -0.8000],
          [ 0.0000, -0.8000],
          [ 0.4000, -0.8000],
          [ 0.8000, -0.8000]],

         [[-0.8000, -0.4000],
          [-0.4000, -0.4000],
          [ 0.0000, -0.4000],
          [ 0.4000, -0.4000],
          [ 0.8000, -0.4000]],

         [[-0.8000,  0.0000],
          [-0.4000,  0.0000],
          [ 0.0000,  0.0000],
          [ 0.4000,  0.0000],
          [ 0.8000,  0.0000]],

         [[-0.8000,  0.4000],
          [-0.4000,  0.4000],
          [ 0.0000,  0.4000],
          [ 0.4000,  0.4000],
          [ 0.8000,  0.4000]],

         [[-0.8000,  0.8000],
          [-0.4000,  0.8000],
          [ 0.0000,  0.8000],
          [ 0.4000,  0.8000],
          [ 0.8000,  0.8000]]]], dtype=torch.float64)

tensor([[[[ 0.0000,  1.0000,  2.0000,  3.0000,  4.0000],
          [ 5.0000,  6.0000,  7.0000,  8.0000,  9.0000],
          [10.0000, 11.0000, 12.0000, 13.0000, 14.0000],
          [15.0000, 16.0000, 17.0000, 18.0000, 19.0000],
          [20.0000, 21.0000, 22.0000, 23.0000, 24.0000]]]],
       dtype=torch.float64)

Can someone explain to me how to interpret the output of affine grid in this case? I want to understand how such a grid achieves identity transformation and in general other transformations as well.
Thanks in advance!!