Skip to content

Commit

Permalink
Struct scalars support __array_interface__
Browse files Browse the repository at this point in the history
  • Loading branch information
shwina committed Feb 10, 2025
1 parent 08d0643 commit 0429181
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/cuda_parallel/cuda/parallel/experimental/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def __post_init__(self):
[tuple(getattr(self, name) for name in anns)], dtype=self.dtype
)

def __array_interface__(self):
return self._data.__array_interface__

setattr(this, "__post_init__", __post_init__)
setattr(this, "__array_interface__", property(__array_interface__))

# Wrap `this` in a dataclass for convenience:
this = dataclass(this)
Expand Down

0 comments on commit 0429181

Please sign in to comment.