Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch ups to Array #475

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Touch ups to Array
  • Loading branch information
jakirkham committed Sep 28, 2024
commit 89c76019b18f7d335c7160129a01e6d08e43dc52
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.
madsbk marked this conversation as resolved.
Show resolved Hide resolved
# 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):
madsbk marked this conversation as resolved.
Show resolved Hide resolved
if isinstance(obj, Array):
return obj
return <Array>obj
else:
return Array(obj)

Expand Down