-
Notifications
You must be signed in to change notification settings - Fork 41
Split five more operations into meaning and computation #985
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
Open
d-chambers
wants to merge
6
commits into
dev
Choose a base branch
from
processors-7
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1e4f1e8
Check the branches the next five splits will touch
d-chambers 083bbd5
Split five more operations into meaning and computation
d-chambers 52d1c49
Keep the two things numpy allowed that the standard does not
d-chambers f419807
Decide which kernel runs before any data is seen
d-chambers ba70177
Plan the kernel from the parameters, and leave the caller's arrays alone
d-chambers 5ed0cc1
Ask whether the standard takes these arguments, not whether they fuse
d-chambers 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
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
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
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.
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
For array-api-compat version 1.9.0, does a non-NumPy Array API namespace guarantee thatxp.asarray(numpy.float32(1), dtype=..., device=...)is accepted? Cite the Array API specification or array-api-compat documentation for accepted scalar input types.💡 Result:
For array-api-compat version 1.9.0, there is no guarantee that
xp.asarray(numpy.float32(1), ...)is accepted across all non-NumPy namespaces. The array-api-compat library is designed to wrap existing array library namespaces (such as CuPy, PyTorch, or JAX) to make them more compliant with the Array API standard [1][2]. It does not modify the underlying array objects themselves, nor does it enforce a unified, library-agnostic behavior for inputs that fall outside the standard's strict requirements [3][4][5]. Regarding the Array API specification and input types: 1. The Array API standard defines thatasarray()accepts array-like objects (including other arrays and sequences) [6][7]. 2. The standard is generally concerned with interoperability between standard-compliant array objects. It does not mandate that libraries must accept foreign array scalars (likenumpy.float32) withinasarray(), and many libraries (such as PyTorch or JAX) do not inherently treatnumpy.float32as a native or universally accepted scalar type in their creation functions [3][4]. 3. Because array-api-compat preserves the underlying array library's native implementation for most functions—relying on the library's ownasarrayor equivalent—the behavior is ultimately governed by the wrapped library [3][4][5]. If a library'sasarrayimplementation does not recognizenumpy.float32as a valid input, array-api-compat will not override this to force acceptance [3][4]. For portable code, it is recommended to pass standard Python scalars (bool, int, float, complex) or ensure that inputs are converted to a library-compatible format before callingxp.asarray()[8].Citations:
🏁 Script executed:
Repository: DASDAE/dascore
Length of output: 38117
🏁 Script executed:
Repository: DASDAE/dascore
Length of output: 15439
🌐 Web query:
Array API specification asarray accepted input types Python scalar NumPy scalar array-like foreign scalar💡 Result:
According to the Python Array API standard, the asarray function is designed to convert an input object into an array [1]. The accepted input types for the obj parameter are formally defined as follows [1][2]: 1. Array objects conforming to the Array API standard [1][2]. 2. Python scalars: bool, int, float, and complex [1][2]. 3. Nested sequences of Python scalars [1][2]. 4. Objects supporting the Python buffer protocol [1][2]. Regarding the specific types mentioned in your query: Python Scalars: As noted above, Python scalars (bool, int, float, complex) are explicitly supported as valid input types [1][2]. NumPy Scalars: The Array API standard does not formally include "NumPy scalars" as a distinct input type [3]. However, because NumPy scalars generally implement a duck-typed interface that behaves like 0-D arrays, they are often accepted in practice by conforming libraries [4][3]. The standard itself focuses on array objects and Python-native types [1][3]. Foreign Scalars: The standard does not contain a formal definition for "foreign scalars" [1][5]. In the context of interoperability, libraries may implement their own handling for non-standard inputs [2][6]. If an input is not one of the explicitly supported types, the behavior is typically implementation-defined; conforming implementations may attempt a conversion or raise an exception [2]. Array-like: While many libraries traditionally use "array-like" to describe a broad range of inputs (such as lists or objects with an array method), the Array API standard is stricter [7]. It explicitly specifies support for the buffer protocol and nested sequences, but does not require broader "array-like" support beyond what is defined in the specification [8]. Use of the asarray pattern for arbitrary "array-like" objects is often discouraged in favor of explicit conversion or checking for array_namespace [7].
Citations:
🏁 Script executed:
Repository: DASDAE/dascore
Length of output: 1793
Route NumPy scalar fill values through
numpy_kernel.np.float32(1)has zero dimensions, soFillNa.needs_numpyselects the portable kernel. The Array API does not requirexp.asarrayto accept NumPy scalar objects. Apply the same exact-type check used byFull.needs_numpyto route these values throughnumpy_kernel.🤖 Prompt for AI Agents