Skip to content

dlpack interface with pytorch fails on CPU (both ways) #1240

Open
@fcharras

Description

@fcharras
  • From dpctl to pytorch:

    import dpctl.tensor as dpt
    import intel_extension_for_pytorch
    import torch
    array_dpctl_cpu = dpt.reshape(dpt.arange(1000, device="cpu", dtype=dpt.float32), (4, 250))
    array_torch_cpu = torch.from_dlpack(array_dpctl_cpu)

    fails with:

    RuntimeError: Data pointer is not bound to the default context of the specific device.
    
  • from pytorch to dpctl:

    import dpctl.tensor as dpt
    import intel_extension_for_pytorch
    import torch
    array_torch_cpu = torch.arange(1000, dtype=torch.float32, device="cpu").reshape(4, 250)
    array_dpctl_cpu = dpt.from_dlpack(array_torch_cpu)

    fails with

    BufferError: The DLPack tensor resides on unsupported device.
    

Should those conversions be possible ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions