-
Notifications
You must be signed in to change notification settings - Fork 35
PyTorch compatibility layer #14
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
Merged
Changes from 30 commits
Commits
Show all changes
95 commits
Select commit
Hold shift + click to select a range
f49f42b
Start pytorch compatibility layer
asmeurer 4b95748
Add vendor tests for torch
asmeurer 1ecb7ca
Replace torch expand_dims wrapper to a wrapper around unsqueeze
asmeurer 52b6054
Add torch support to the helper functions
asmeurer c484dbf
Add max and min wrappers for torch
asmeurer 3023a89
Add a wrapper for torch.prod
asmeurer a1bbd9b
Add the torch prod wrapper to __all__
asmeurer dba7fa7
Return a copy from max and min with axis=()
asmeurer 44d91e1
Add a size() helper function
asmeurer 1faea7b
Add any and all torch wrappers and fix some issues with prod
asmeurer ad4484d
Add astype torch wrapper
asmeurer db3241d
Cast the input to prod/all/any to tensor
asmeurer 3f0d913
More logical order for some functions
asmeurer 2d25dd2
Add wrappers for two-argument elementwise functions
asmeurer c4c0cfa
Add bitwise_invert to torch
asmeurer a1917f8
Add torch wrappers for broadcast_to and can_cast
asmeurer ae28ce0
Add torch arange wrapper
asmeurer c3d9334
Add a wrapper for torch.eye
asmeurer f4d6df1
Add pytorch linspace wrapper
asmeurer 14b6519
Add torch squeeze wrapper
asmeurer db3f579
Add torch flip and roll wrappers
asmeurer 27b7e8c
Add a torch wrapper for nonzero
asmeurer e886644
Fix pyflakes warning
asmeurer fd5d179
Add torch wrapper for where
asmeurer a5f3253
Add sort wrapper to torch
asmeurer 4a71e63
Pass kwargs through some torch wrappers
asmeurer 157fc1e
Add torch mean(), std(), and var() wrappers
asmeurer c3efe6a
Add torch sum() and prod() wrappers
asmeurer ed46247
Add unique_* wrappers to torch
asmeurer eaf5358
Just raise NotImplementedError in pytorch unique_all()
asmeurer cd25f47
Fix to_device for pytorch tensors
asmeurer 98ed0b2
Restrict the names imported from torch into the compat submodule
asmeurer be4b534
Allow torch sum and prod to upcast uint8 to int64
asmeurer ecda017
Don't unnecessarily flip the axes in flip()
asmeurer 3ccee1b
Comment out dead code in the torch unique_all() wrapper
asmeurer 7699755
Use flatten instead of ravel
asmeurer d38bad5
Improve some error messages
asmeurer 24c0ea3
Use a better function name and use unsqueeze instead of None indexing
asmeurer 48d1ae1
Add pytorch-xfails.txt (still need to validate)
asmeurer 866647d
Move main namespace linear algebra helpers to _aliases.py
asmeurer 85b71de
Merge branch 'master' into pytorch
asmeurer c441f33
Fix main namespace linalg functions in numpy and cupy
asmeurer 04eef18
Add main namespace linalg functions to the torch wrapper
asmeurer 453ecb8
Add torch wrapper for matmul
asmeurer 5a3bbbe
Finish torch wrappers for matmul, vecdot, and tensordot
asmeurer b8bbdc8
Clean up pytorch-xfails file
asmeurer 7d176b9
Update pytorch-xfails.txt
asmeurer 17c0a91
Merge branch 'main' into pytorch
asmeurer 1ffcb15
Install pytorch in on CI
asmeurer 0db034d
Make the GitHub Actions workflow reusable so that we can test pytorch
asmeurer 39cbfd4
Fix workflow path
asmeurer c3d0d8e
Fix variable interpolation syntax
asmeurer cf21cea
Allow specifying extra pytest args in the test yamls
asmeurer a95eeb6
Enable verbose output for the torch tests
asmeurer 4737dc0
Revert "Enable verbose output for the torch tests"
asmeurer ea9c1e2
Skip the torch test that crashes the CI
asmeurer 4904411
Skip another test that crashes on CI
asmeurer 039af59
Disable linalg in the torch CI tests
asmeurer 367c4b6
Add missing torch xfails
asmeurer f3ee38c
Do a verbose CI run for the pytorch array API tests
asmeurer c631fa3
Revert "Do a verbose CI run for the pytorch array API tests"
asmeurer 33dacf9
Add some missing torch xfails
asmeurer 82b8def
Do a verbose output run of the torch array API tests (with the correc…
asmeurer b014c1b
Revert "Do a verbose output run of the torch array API tests (with th…
asmeurer 124d6c3
Add a missing torch xfail
asmeurer 847a9e5
Add a missing torch xfail
asmeurer 0857b86
Skip test_floor_divide, which core dumps on CI
asmeurer 6354cd9
Add a missing torch xfail
asmeurer 0565dee
Update the README
asmeurer e9b447c
Fix some formatting in the README
asmeurer bb4d3af
Typo fix
asmeurer 5545635
Update torch reduction functions that don't support multiple axes
asmeurer a78f733
Add a test skip that crashes on CI
asmeurer 0cefa7b
Add a CHANGELOG for the upcoming 1.1 release
asmeurer 1aceff5
Add more skips for tests that crash on CI
asmeurer b016d4c
Skip a torch test that crashes CI
asmeurer 1cd43f2
Add a torch xfail
asmeurer c8a5a70
Add a script to manually run the cupy tests
asmeurer 7261dae
Add a torch skip
asmeurer 795dbea
Merge branch 'pytorch' of github.com:asmeurer/array-api-compat into p…
asmeurer 0368c8f
Use cupy specific skips and xfails
asmeurer 2b456c2
Allow passing pytest args through in test_cupy.sh
asmeurer 046ffd0
Add a shebang to test_cupy.sh
asmeurer c3eb0d5
Make the hypothesis examples database persistent in test_cupy.sh
asmeurer 111a122
Fix sort() and argsort() with cupy
asmeurer 09b5a6f
Add comments for the rest of the cupy xfails
asmeurer b780b9a
Merge branch 'pytorch' of github.com:asmeurer/array-api-compat into p…
asmeurer 1908a00
Fix argument quoting in test_cupy.sh
asmeurer 5cbd1c0
Update cupy skips and xfails
asmeurer 6a63d5c
Update cupy xfails
asmeurer 175f195
Update test_cupy.sh to run the vendoring tests
asmeurer d1c7999
Add a minor CHANGELOG entry
asmeurer 0e923b6
Merge branch 'pytorch' of github.com:asmeurer/array-api-compat into p…
asmeurer 2fb0a0a
Bump the version to 1.1
asmeurer 3470b36
Add a missing torch skip
asmeurer 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from torch import * | ||
|
||
# Several names are not included in the above import * | ||
lezcano marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import torch | ||
for n in dir(torch): | ||
if not n.startswith('_'): | ||
asmeurer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exec(n + ' = torch.' + n) | ||
|
||
# These imports may overwrite names from the import * above. | ||
from ._aliases import * | ||
|
||
from ..common._helpers import * | ||
|
||
__array_api_version__ = '2021.12' |
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.
Uh oh!
There was an error while loading. Please reload this page.