Fast method for get the gradient of an image

torch.nn.functional.conv2d