affine_grid() in pytorch

According to PyTorch document, In PyTorch, torch.nn.functional.affine_grid generates a 2D or 3D flow field (sampling grid) based on a batch of affine matrices. It is almost exclusively used in combination with torch.nn.functional.grid_sample to perform geometric transformations like rotation, translation, scaling, and shearing. The following code examples show part of a Read more…