Skip to content

Comments

Remove torch_to_cupy and cupy_to_torch functions#27

Open
aknierim wants to merge 2 commits intomainfrom
cupy-dlpack-deprecation-fix
Open

Remove torch_to_cupy and cupy_to_torch functions#27
aknierim wants to merge 2 commits intomainfrom
cupy-dlpack-deprecation-fix

Conversation

@aknierim
Copy link
Member

@aknierim aknierim commented Jan 6, 2026

Cupy's fromDlpack and toDlpack as well as PyTorch's torch.utils.dlpack.to_dlpack methods are deprecated.

Packages following the array API standard like Cupy and PyTorch now provide the __dlpack__ method which allows conversion through the array_namespace.from_dlpack method.

import torch
import cupy as cp

test_tensor = torch.tensor([1])
print("__dlpack__" in dir(test_tensor))  # True

test_array = cp.array([1])
print("__dlpack__" in dir(test_array))  # True

Cupy's fromDlpack and toDlpack as well as PyTorch's
torch.utils.dlpack.to_dlpack methods are deprecated.

Packages following the array API standard now provide
the __dlpack__ method which allows conversion through
the array_namespace.from_dlpack method.
@aknierim aknierim requested a review from Kevin2 January 6, 2026 11:20
@aknierim aknierim added the enhancement New feature or request label Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant