-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Open
Labels
module: deprecationmodule: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
PyTorch's torch.meshgrid is divergent from NumPy's np.meshgrid. The documentation for these functions is very hard to parse, so I am not sure if this is a bug or not.
Snippet demonstrating the divergence:
nx, ny = (3, 2)
x = np.linspace(0, 1, nx)
y = np.linspace(0, 1, ny)
xv, yv = np.meshgrid(x, y)
xv
: array(
[[0. , 0.5, 1. ],
[0. , 0.5, 1. ]])
xv, yv = torch.meshgrid(torch.from_numpy(x), torch.from_numpy(y))
xv
: tensor(
[[0.0000, 0.0000],
[0.5000, 0.5000],
[1.0000, 1.0000]], dtype=torch.float64)
NumPy's np.meshgrid is a top 100 NumPy function. PyTorch's meshgrid is used hundreds of times within Facebook.
Metadata
Metadata
Assignees
Labels
module: deprecationmodule: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operatorstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module