Skip to content

Commit

Permalink
Touch ups to Array
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Sep 28, 2024
1 parent 638d53d commit 89c7601
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions python/kvikio/kvikio/_lib/arr.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ cdef class Array:
cpdef Py_ssize_t _nbytes(self)


cpdef Array asarray(obj)


cdef pair[uintptr_t, size_t] parse_buffer_argument(
buf, size, bint accept_host_buffer
) except *
2 changes: 1 addition & 1 deletion python/kvikio/kvikio/_lib/arr.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved.
# See file LICENSE for terms.

from typing import Generic, Tuple, TypeVar
Expand Down
5 changes: 3 additions & 2 deletions python/kvikio/kvikio/_lib/arr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ cdef inline Py_ssize_t _nbytes(Py_ssize_t itemsize,
nbytes *= shape_mv[i]
return nbytes

cpdef asarray(obj):

cpdef Array asarray(obj):
if isinstance(obj, Array):
return obj
return <Array>obj
else:
return Array(obj)

Expand Down

0 comments on commit 89c7601

Please sign in to comment.