Skip to content

Commit

Permalink
fix: Add torch.utils.dlpack frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
hmahmood24 committed Sep 16, 2024
1 parent 8183a22 commit 9412c70
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ivy/functional/frontends/torch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def promote_types_of_torch_inputs(
conv_transpose2d,
conv_transpose3d,
)
from . import utils
from .utils import *
from . import special
from . import tensor
from . import _VF
Expand Down
5 changes: 0 additions & 5 deletions ivy/functional/frontends/torch/creation_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ def eye(
return ivy.eye(n, m, dtype=dtype, device=device, out=out)


@to_ivy_arrays_and_back
def from_dlpack(ext_tensor):
return ivy.from_dlpack(ext_tensor)


@to_ivy_arrays_and_back
def from_numpy(data, /):
return ivy.asarray(data, dtype=ivy.dtype(data))
Expand Down
1 change: 1 addition & 0 deletions ivy/functional/frontends/torch/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .dlpack import *
15 changes: 15 additions & 0 deletions ivy/functional/frontends/torch/utils/dlpack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# local
import ivy
from ivy.functional.frontends.torch.func_wrapper import (
to_ivy_arrays_and_back,
)


@to_ivy_arrays_and_back
def from_dlpack(ext_tensor):
return ivy.from_dlpack(ext_tensor)


@to_ivy_arrays_and_back
def to_dlpack(ext_tensor):
return ivy.to_dlpack(ext_tensor)

0 comments on commit 9412c70

Please sign in to comment.