Currently, neither vanilla torch nor array-api-compat torch seem to accept the copy keyword. (Or the device keyword, of course, but that is probably harder to deal with.)
import numpy as np
import torch
from array_api_compat import array_namespace
xp = array_namespace(torch.asarray([1, 2, 3]))
x = np.asarray([1, 2, 3])
y = xp.from_dlpack(x, copy=False) # TypeError: from_dlpack() got an unexpected keyword argument 'copy'
y = torch.from_dlpack(x, copy=False) # TypeError: from_dlpack() got an unexpected keyword argument 'copy'
Should the array-api-compat version accept it, or does it need to wait for PyTorch itself?
Needs to wait I think, that's also DLPack 1.0. from_dlpack only passes the copy keyword on to dlpack, and the copying is expected to be done by the producer.
Currently, neither vanilla torch nor array-api-compat torch seem to accept the
copy
keyword. (Or thedevice
keyword, of course, but that is probably harder to deal with.)Should the array-api-compat version accept it, or does it need to wait for PyTorch itself?
Crossref scipy/scipy#21890