Skip to content

Native support for PyTorch CPU tensors #6276

Open
@vhewes

Description

Is your feature request related to a problem? Please describe.
CuML doesn't natively support PyTorch tensors on CPU. When a tensor is on GPU, it can be fed into a CuML algorithm directly because it supports __cuda_array_interface__, but when a tensor is on CPU it raises TypeError: Cannot interpret 'torch.float32' as a data type. This can be easily worked around by the user by adding a block like

if not t.is_cuda:
    t = t.numpy()

before passing a CPU tensor t into a RAPIDS algorithm, but it requires a couple of extra lines in user code.

Describe the solution you'd like
Let the RAPIDS interface call .numpy() on input PyTorch CPU tensors under the hood, so the user doesn't need to do so manually.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions