pytorch / xla

Enabling PyTorch on XLA Devices (e.g. Google TPU)
https://pytorch.org/xla
Other
2.5k stars 482 forks source link

DLPack: fix test using PyTorch API. #8348

Open ysiraichi opened 3 weeks ago

ysiraichi commented 3 weeks ago

This PR fixes the test introduced in #7213, where it called PyTorch's to_dlpack() function before actually calling from_dlpack(). Meaning that both Tensor.__dlpack__ and Tensor.__dlpack_device__ functions weren't getting called, which were the functions that that test was supposed to be testing.

This should be merged after https://github.com/pytorch/pytorch/pull/138470.

cc @JackCaoG @vanbasten23 @qihqi

ysiraichi commented 3 weeks ago

At first, I won't add the .torch_pin file, so as to make sure the test is failing without https://github.com/pytorch/pytorch/pull/138470. Then, I will add it, so as to make sure it is the reason the test passes.