Closed
Description
torch.reshape
requires an tuple as the shape:
import torch
import array_api_compat
x = torch.asarray([1.0, 2.0])
xp = array_api_compat.get_namespace(x)
# works
xp.reshape(x, (-1,))
xp.reshape(x, -1)
# TypeError: reshape(): argument 'shape' (position 2) must be tuple of ints, not int
Note that integer shape
works with numpy.array_api
:
import numpy.array_api as np
import array_api_compat
x = np.asarray([1.0, 2.0])
xp = array_api_compat.get_namespace(x)
xp.reshape(x, -1)
Metadata
Metadata
Assignees
Labels
No labels