Coordinate

The x,y coordinate system of ConvDO is different from the Row/Column system of PyTorch/Numpy. It is always ideal to check the coordinate system of your data before calculate the residual.

See Operator with obstacles tutorial for more information.

import torch
import matplotlib.pyplot as plt
field=torch.zeros(1,1,63,127)
# left boundary
field=torch.nn.functional.pad(field,(1,0,0,0),mode="constant",value=1)
# top boundary
field=torch.nn.functional.pad(field,(0,0,1,0),mode="constant",value=2)
print(field.shape)
# mesh: 128(x) * 64(y)

plt.imshow(field.squeeze().squeeze().numpy())
plt.xlabel("Column, →")
plt.ylabel("Row, ←")
plt.title("Illustration of the default PyTorch/Numpy coordinate system.")
plt.show()

plt.imshow(field.squeeze().squeeze().numpy())
plt.xlabel("x, $\mathbf{i}$, →, (bottom)")
plt.ylabel("y, $\mathbf{j}$, →, (left)")
plt.yticks(range(0,64,8),[64-i for i in range(0,64,8)])
plt.title("Illustration of the ConvDO coordinate system. \n Vector $(x,y)$ is represented as $x \mathbf{i}+y \mathbf{j}$")
plt.show()
torch.Size([1, 1, 64, 128])

No description has been provided for this image
No description has been provided for this image