Cross no longer supports broadcasting

Why does torch.linalg.cross no longer support broadcasting like e.g.
I am using expressions like:

x = torch.linalg.cross(m, p)

where m is a vector field with shape (nx, ny, nz, 3) and p is a material parameter.
p may either be of the same shape as m or of shape (3) if the material is constant.

Both versions worked with a previous version of pytorch, but this behaviour was changed in ‘Strenghten preconditions of linalg.cross (#83798)’. Now the second version raises the following exception:

RuntimeError: linalg.cross: inputs must have the same number of dimensions.

I would now need to check the dimension of p first and reshape / expand accordingly.
Is there a more elegant way?

best wishes

I think expanding is the right approach and something like this should work:

m = torch.randn(6, 5, 4, 3)
p = torch.randn(3)

x = torch.linalg.cross(m, p.expand_as(m))

Ah, cool. Thanks for the fast solution.

best wishes