Add pytato.array_api: Python Array API conformance namespace + test infrastructure#663
Draft
Copilot wants to merge 3 commits into
Draft
Add pytato.array_api: Python Array API conformance namespace + test infrastructure#663Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
…ture Agent-Logs-Url: https://github.com/inducer/pytato/sessions/27a6a877-efd8-47c9-b399-7d7ab8bf2e5c Co-authored-by: inducer <352067+inducer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/inducer/pytato/sessions/27a6a877-efd8-47c9-b399-7d7ab8bf2e5c Co-authored-by: inducer <352067+inducer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add script to test Pytato against Python API standard
Add pytato.array_api: Python Array API conformance namespace + test infrastructure
May 8, 2026
alexfikl
reviewed
May 8, 2026
| PYTATO_REDUCTION_TO_NP_REDUCTION: Mapping[type[ReductionOperation], str] = { | ||
| SumReductionOperation: "sum", | ||
| ProductReductionOperation: "product", | ||
| ProductReductionOperation: "prod", |
Contributor
There was a problem hiding this comment.
@inducer This should probably make it to main first, since np.product no longer exists 😁
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implements the Array API 2023.12-compatible namespace (
pytato.array_api) and wires up thearray-api-testsconformance suite against it.How it works
Each operation in
pytato.array_apiwraps inputs in pytatoDataWrappernodes, builds the pytato expression graph, then immediately evaluates via the newNumpyPythonTarget— exercising pytato's full codegen pipeline while returning concrete numpy results the conformance tests can inspect.Changes
pytato/array_api.py— new module implementing the full Array API 2023.12 surface: creation, element-wise, reductions, manipulation, searching/sorting, set functions, linear algebra, indexing,__array_namespace_info__, etc.pytato/target/python/__init__.py— addsNumpyPythonTarget, a concreteNumpyLikePythonTargetsubclass that generates code targetingnumpy(used byarray_api.pyfor eager evaluation).pytato/target/python/numpy_like.py— fixesProductReductionOperationcodegen mapping from removednumpy.product→numpy.prod(NumPy 2.0 compatibility bug)..github/workflows/array_api.yml— CI job that clonesarray-api-testsat HEAD and runs the conformance suite againstpytato.array_api.array-api-tests.xfails.txt— expected failures: missing optional extensions (linalg,fft) and scalar weak-typing differences (Pythonintscalar + integer array dtype promotion deviates from Array API spec).Current conformance status
With
--max-examples=50: 452 pass, 37 fail (all failures are the unimplementedlinalg/fftoptional extensions listed inxfails.txt), 97 skipped.