Skip to content

torch.meshgrid always uses indexing='xy' #340

Open
@mdhaber

Description

@mdhaber

Looks like array_api_compat.torch.meshgrid now always uses indexing='xy'. These shouldn't pass, but do.

from array_api_compat import torch as xp
x = xp.asarray([1, 2, 3, 4])
y = xp.asarray([6, 7, 8])
Xxy, Yxy = xp.meshgrid(x, y, indexing='xy')
Xij, Yij = xp.meshgrid(x, y, indexing='ij')

assert xp.all(Xxy == Xij)
assert xp.all(Yxy == Yij)

import numpy as np
X, Y = np.meshgrid(x, y, indexing='xy')
np.testing.assert_equal(Xij, X)
np.testing.assert_equal(Yij, Y)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions