Spatial transformer network's grid generator

I implemented a code with the paper ‘Spatial transformer Network’ and tutorial code of pytorch ‘https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html’.

But the result I expected was different to the result of the paper.

This is the result of my code.
Right pictures are the result of spatial transformer network.
But the paper said that the result of spatial transformer network is not the whole input picture but the part of the the input because of the grid generator.

Can you help me to solve this problem?
The loss function is decreased well and the accuracy is increasing well. Both graphs are converged.

I think that the code of the tutorial ‘affine_grid’ which calculates the location for sampling is not working well…