-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* more changes to improve behavior with array API test suite
- Loading branch information
1 parent
a949831
commit 14330c2
Showing
6 changed files
with
86 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import pykokkos as pk | ||
|
||
def zeros(shape, *, dtype=None, device=None): | ||
return pk.View([*shape], dtype=dtype) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pykokkos as pk | ||
|
||
import numpy as np | ||
|
||
# TODO: add proper implementations rather | ||
# than wrapping NumPy | ||
# These are required for the array API: | ||
# https://data-apis.org/array-api/2021.12/API_specification/utility_functions.html | ||
|
||
def all(x, /, *, axis=None, keepdims=False): | ||
if x == True: | ||
return True | ||
elif x == False: | ||
return False | ||
np_result = np.all(x) | ||
ret_val = pk.View(pk.from_numpy(np.all(x))) | ||
return ret_val | ||
|
||
|
||
def any(x, /, *, axis=None, keepdims=False): | ||
return pk.View(pk.from_numpy(np.any(x))) |