-
Notifications
You must be signed in to change notification settings - Fork 64
[Data API] Array Object Implementation #261
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
Merged
syurkevi
merged 29 commits into
arrayfire:master
from
roaffix:feature/array-api-array-object
Apr 25, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
75c1d43
Refactoring of basic functionality to create an empty Array
b14aa91
Replace dim4 with CShape
roaffix eadbe9b
Add tests. Minor fixes. Update CI
roaffix c13a59f
Fix CI
roaffix f0f57e8
Add arithmetic operators w/o tests
roaffix 8cef774
Fix array init bug. Add __getitem__. Change pytest for active debug mode
roaffix a4c7ac9
Add reflected arithmetic and array operators
roaffix 4140527
Place TODO for repr
roaffix 4374d93
Add bitwise operators. Add in-place operators. Add missing reflected …
roaffix 5a29ffa
Fix tests
roaffix 4187b27
Add tests for arithmetic operators
roaffix cdb7a92
Added to_list and to_ctypes_array
roaffix 9c0435a
Fix bug when scalar is empty returns None
roaffix 769c16c
Fix typing in array object. Add tests
roaffix fb27e46
Change tests and found bug with reflected operators
roaffix 0afb92e
Fix reflected operators bug. Add test coverage for the rest of the ar…
roaffix 1d071be
Add required by specification methods
roaffix 04fbb1b
Change file names
roaffix 2d91b04
Change utils. Add docstrings
roaffix 5939388
Add docstrings for operators
roaffix 0231e27
Change TODOs
roaffix 07c4206
Add docstrings for other operators. Remove docstrings from mocks
roaffix 908447b
Change tags and typings
roaffix fa3ad06
Change typings from python 3.10 to python 3.8
roaffix 0de9955
Add readme with reference to run tests
roaffix ae6be05
Revert changes accidentally made in original array
roaffix 15bc8cb
Add constructor initialisation warning. Add Note on deviation from sp…
roaffix e24e478
Fix warning message
roaffix f3a80c0
Add NOTE tag to functions that are not a part of spec but custom solu…
roaffix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add docstrings for other operators. Remove docstrings from mocks
- Loading branch information
commit 07c42060aeba5fc0a7bb60e6ea0d53665ede92c8
There are no files selected for viewing
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not following spec, should be Optional[Int]
Copy docstrings from https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.size.html#array_api.array.size
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#optional-types-and-the-none-type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And still, we won't have a case where size equals
None
, but making the returnOptional
will lead us to major logical code changes if we want to keep typing work.Mypy doesn't implement it in their source code as well https://github.com/numpy/numpy/blob/6f3e1f458e04d13bdd56cff5669f9fd96a25fb66/numpy/array_api/_array_object.py#L1088
My point is to keep
int
as an expected return and not try to imagine cases that likely never happen in the future withNone
return.Or, let's switch to TDD and add valid test case for
None
return and then fix typing in the source code 🤷♂️