-
Notifications
You must be signed in to change notification settings - Fork 112
Python array API support #1683
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
Draft
Emvlt
wants to merge
555
commits into
odlgroup:master
Choose a base branch
from
Emvlt:python_array_api_support
base: master
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.
Draft
Python array API support #1683
Changes from 1 commit
Commits
Show all changes
555 commits
Select commit
Hold shift + click to select a range
3353569
Merge branch 'pytorch_backend' into python_array_api_support
Emvlt 7124947
Removing the np.sctypes call.
Emvlt 55a281f
Important bug fix for the in-place __dunder__ operations.
Emvlt 82af750
Changing the default copy behaviour of space.element() to None instea…
Emvlt 33740f7
Doctest and Test package for the currently implemented functions of t…
Emvlt c978a2e
Addition of an array-API compatible can_cast method
Emvlt a6f3e7a
Changes to the operator test to make itarray-API compatible.
Emvlt 709c49b
Minor change to the doctests
Emvlt 3403828
Make Astra-Cuda independent of PyTorch dependency.
leftaroundabout 2c46fc2
Ongoing work to make sure that the module is not loaded if pytorch is…
Emvlt 28843e2
Make the pytorch_tensors module handle non-availability of Torch.
leftaroundabout a3fff16
Make `_convert_dtype` more flexible and efficient.
leftaroundabout 18f9241
Improve naming and documentation for `_convert_dtype`.
leftaroundabout 6162bec
Delegate the finding of a unique identifier for dtype-ish arguments t…
leftaroundabout 6fb66f6
Get rid of the redundand `int` vs `int32` etc. dtype identifiers.
leftaroundabout 44d9ef4
Improve documentation to array-API utils.
leftaroundabout 15922ff
Remove the redundant and in general misformatted `dtype` entry from t…
leftaroundabout f214d7c
Omit dtype/impl/device from space's __repr__ if they are the default …
leftaroundabout 6b78664
Update some doctests that were still using old-style ufunc calls.
leftaroundabout 8134331
Use the ODL version of `abs` iff dealing with ODL objects.
leftaroundabout fedf169
Use explicit NumPy arrays in the doctests for resizing operations.
leftaroundabout 39c487a
Switch some more old NumPy-based tests over to array-APIish ODL.
leftaroundabout dce4d5d
Make some matrix-based operator utils work again, at least for NumPy …
leftaroundabout c3198c4
Update `FlatteningOperator` to ArrayAPI-based ODL.
leftaroundabout ea6e3ae
Correct the logic of when the weighting of a `DiscretizedSpace` needs…
leftaroundabout 05a1b00
Consistent dtype showing for discr_space `__repr__`.
leftaroundabout 2923650
Address a spurious test failure due to negative zeroes.
leftaroundabout a2dbc07
Use the zero-safe xlogy operation (from SciPy) for KL-divergence.
leftaroundabout 6f321ca
Revamp the way `MatrixOperator` decides its storage / computation bac…
leftaroundabout 5ed5499
Make the `_call` of `MatrixOperator` exclusively out-of-place.
leftaroundabout 09c68e3
Generalize `check_device` to accept not only plain string identifiers…
leftaroundabout c704c74
Array-API conformant use of `tensordot`.
leftaroundabout 33d0f2a
Make the `repr` of `MatrixOperator` backend-agnostic.
leftaroundabout 7786d18
Clearer error message when something goes wrong with `_universal_dtyp…
leftaroundabout 2bd2ed6
Always check `MatrixOperator` against NumPy, regardless of its backend.
leftaroundabout fab1a58
Remove redundant doctest that actually shows something different from…
leftaroundabout a04f46a
Update `PyTorchTensor` doctest.
leftaroundabout e0bfe5d
Consistent version of the current semantics for `__eq__`.
leftaroundabout f78cee5
Update `check_device` doctests.
leftaroundabout 25f5fce
Only test PyTorch-Cuda array backend if a suitable GPU is available.
leftaroundabout cad4d26
Generalize the dtype-dependent epsilon used in proximal operators.
leftaroundabout b48ceed
Ensure the operator-composition special case only takes action when a…
leftaroundabout b24700b
Clearer error message when attempting to generate a primitive tensor …
leftaroundabout 5f3be1a
Propose storing what operations are supported in which style in the `…
leftaroundabout a92ba44
Refactoring in `_elementwise_num_operation` to avoid `local_namespace`.
leftaroundabout 2816567
Using the cache in `ArrayBackend` for looking up functions from the n…
leftaroundabout aa4ce51
Carry out the function-call-probing with multiple dtypes.
leftaroundabout c9dab62
Consult the information whether low-level operations support `out` ar…
leftaroundabout 8509070
Changes to the proximal operators:
Emvlt c751688
Changes to the element_wise_num_operation:
Emvlt 89982d4
Changes to the tomo module
Emvlt de365f2
Ensure `set_zero` leaves only zeroes, even if NaNs were previously pr…
leftaroundabout fcdfbf6
Revert changes in 8509070, superseded by de365f2a.
leftaroundabout 60ee6cb
Adjust test to the actually expected dtypes coming from `astype`.
leftaroundabout 8ec13c9
Comment regarding the somewhat confusing dtype defaults.
leftaroundabout 2d04bc1
Remove a backend special casing of type of exception.
leftaroundabout 318d383
Consistent storage of padding constants in the appropriate array back…
leftaroundabout 8778597
Small refactoring in resizing utils.
leftaroundabout b3d2367
Ensure a suitable dtype is used for `arange` in extrapolation padding…
leftaroundabout 39aa011
Replace a NumPy-specific equality check with the general ODL one.
leftaroundabout 217fb86
Backend-agnostic ways of performing the copying and summing needed fo…
leftaroundabout 446d4ca
Get the symmetric boundaries in discr_ops working in PyTorch.
leftaroundabout 8211266
Addition of a skip condition to tomo test if there is no Pytorch
Emvlt 64066b7
Addition of the pytorch projectors to make sure that they are not run…
Emvlt 9132656
Fixing a bug introduced when casting Python Number to tensors. I forg…
Emvlt b0ebb39
Fixes to the linspace and empty function: the wrong arguments were pa…
Emvlt a11bc4a
Minor change to base_tensors to include radd and rsub to Operator alg…
Emvlt a852aa0
Change to adapt test comparisons to pytorch (np.matmul -> namespace.m…
Emvlt f871ecc
Change to the MatrixOperator Operator: including the device when the …
Emvlt 3f93b46
Changes to the function of oputils to infer the array namespace, the…
Emvlt 05e5eff
Making the oputils_test array-API compatible
Emvlt 5536050
Change tot the testutils as == does not work the same way in pytorch …
Emvlt 8a28b34
Making the pspace_ops_test module array-API compatible
Emvlt 8afcf5f
Change to the PointWiseNorm operator.
Emvlt 0d7773d
Work on the PointwiseTensorField Operators to make them array-API com…
Emvlt ad17b6a
A mistake had slipped through a copy paste >:(
Emvlt 2e67787
Ongoing work to make the tensor_ops_test array API compatible
Emvlt e7f2c45
Modification of the samplingOperator to make it array-API compatible
Emvlt a232767
Introduction of a sparse package to ODL. So far, it entails:
Emvlt af90b89
Adaptation of the MAtrixOperator to the new odl support of SparseMatr…
Emvlt 796af17
Making the tensor_ops_test array-API compatible.
Emvlt 2593f07
Makin the tensor_ops module array-API compatible.
Emvlt 5a01213
Adding a skip mark if pytorch is absent (redundant with the one in to…
Emvlt c6c829b
Only define PyTorch-specific util when available.
leftaroundabout 4039fee
Avoid excessively short/cryptic but public attribute on `MatrixOperat…
leftaroundabout fb39687
More fitting name for the dataclass separating different kinds of spa…
leftaroundabout bdaa73d
Ensure every sparse format is uniquely registered.
leftaroundabout 9abd5ff
More descriptive name for the predicate checking a sparse matrix matc…
leftaroundabout 90f2b5a
Use only the automatically populated registry for sparse formats.
leftaroundabout 9f099d6
Refactor the lookup logic for sparse format.
leftaroundabout f0382bb
Make `lookup_sparse_format` public.
leftaroundabout 0396e4a
Start basing the way sparse matrices are handled on `SparseMatrixForm…
leftaroundabout 8605cf0
Move logic for conversion to dense matrix into `SparseMatrixFormat` c…
leftaroundabout 1c966c2
Abstract also matrix multiplication into `SparseMatrixFormat`.
leftaroundabout d8fa2bb
Add a backend-method for explicit copying to a different device.
leftaroundabout 39e4a5e
Add device-changing methods to the space and weighting classes.
leftaroundabout 482f01a
Fix forgotten device argument dto the ArrayWeighting creation of asde…
Emvlt 2ee8944
`to_device` is already in the Python Array API, so no need to have it…
leftaroundabout fbab953
Rename the device-changing method to be in line with the array API.
leftaroundabout c6f21ef
Changes to the iterative solvers to make them array API compatible.
Emvlt 606b5c2
Changes to the functional tests to make them array-API compatible.
Emvlt 3f44812
Change to the ODL init file.
Emvlt 934fe6f
Chjanges to the scipy compatibility module.
Emvlt fd91043
Removing unecessary, lazy imports of scipy
Emvlt 3b5f8f2
Changes to the ProximalConvexConjKLCrossEntropy Operator to make it a…
Emvlt 22f01ec
Removal of the operator import .
Emvlt 0affcbc
Removing unecessary, lazy imports of scipy
Emvlt 9bc0141
Merge branch 'python_array_api_support' of https://github.com/Emvlt/o…
Emvlt 803d33d
`to_impl` methods, to convert one tensor space to the corresponding v…
leftaroundabout 446d9b7
Documentation for the `to_impl` and `to_device` methods.
leftaroundabout f815294
Revert "`to_device` is already in the Python Array API, so no need to…
leftaroundabout b5725e1
`to_device` for TensorSpace elements.
leftaroundabout 3eced51
Correct outdated documentation type hint.
leftaroundabout e9a0eef
`to_impl` for tensor space elements.
leftaroundabout 914ae5b
Implement device-changing methods in `DiscretizedSpace`.
leftaroundabout 43a87c3
Draft operator for changing device.
leftaroundabout 58946bc
Sanity checks to ensure consistency of device-changing operator.
leftaroundabout 492795f
Some documentation to `DeviceChangeOperator`.
leftaroundabout cff1973
Operator that transfers between different backends.
leftaroundabout 45d8259
Attempt at making the sampling functions in discr_utils PyTorch-compa…
leftaroundabout a1ae8f3
Addition of a is_array_supported method to check whether an array if …
Emvlt d79fde0
Messy commit: ongoing work to make the point_collocation function wor…
Emvlt 4c516ca
Making the default_functions_test array-API compatible. This one had …
Emvlt dbf9f58
Merge branch 'python_array_api_support' of github.com:Emvlt/odl into …
Emvlt d40066c
Ongoing work to make the point_collocation array-API compatible.
Emvlt 2d2bd8a
Reintroduce a check that padding constants can actually be represente…
leftaroundabout a34860e
Changes to the sampling function code.
Emvlt afdb7e5
Changes to the discr_utils_test to make it array-API compatible.
Emvlt cd5044e
Test and discr module cleanup
Emvlt e8b0165
Minor changes to the ray_trafo_test to make it array-API compatible
Emvlt aed3576
Making the function of the geometric phantoms array api compatible
Emvlt c7fcb01
Making the discr ops/space/utils test array-API compatible
Emvlt c61ce26
Merge branch 'python_array_api_support' of github.com:Emvlt/odl into …
Emvlt fc72570
Attempt at making gradient operators compatible with PyTorch.
leftaroundabout f4a71c7
Propose using PyTorch convolution for finite-differences.
leftaroundabout 900212d
Correct axis association of the convolution FDs.
leftaroundabout 7a9c5bd
PyTorch version of finite-difference grad etc..
leftaroundabout 85dbfc6
Consistent use of PyTorch finite_diff also for divergence operator.
leftaroundabout 9c52cbf
Refactor finite-difference kernels.
leftaroundabout fd68ec0
Use correct Torch device for FD convolutions.
leftaroundabout d4e5a71
Big commit: Making Interpolator and Finite diff array-API compatible.
Emvlt 43e56ec
Making Module array-API compatible.
Emvlt 02d6363
Two changes to the DFT:
Emvlt 9b27fef
Changing the function to make it array-API compatible.
Emvlt 3d445f1
Modifications to the ft_utils module.
Emvlt ba98ac1
Changing the numerics_test to adapt the new errors raised by fast_1d_…
Emvlt a873744
Changes to make the fourier transform array-API compatible.
Emvlt 24fec94
Removed a duplicated impl argument that had slept through
Emvlt bcb03b5
Rest of the changes necessary to make the trafos_test array-API compa…
Emvlt 1a7ce80
Roll back changes in 43e56ec that switched coordinate-only computatio…
leftaroundabout 8c2b375
Providing the real/complex correspondent dtypes straight as backend-s…
leftaroundabout 73b6f1d
Properly support non-NumPy backends as the displacement of interpolat…
leftaroundabout b1d856a
change on the vectorization module to make sure that is_valid_inpuit_…
Emvlt ff3945f
Minor change to the discr test to add a pytorch case distinction
Emvlt 0f08eea
Fixing discrepancy between pytorch and numpy behaviour of nonzero()
Emvlt 5aa2296
Removing string nearest neighbour interpolation test
Emvlt 80fae61
Removing the possibility of doing string nearest neighbour interpolat…
Emvlt 9f40fb2
Fixing a behaviour problem of _find_indices methods of _Interpolator …
Emvlt 7d5b6ce
Changes to make the solvers test compatible with the new API
Emvlt 2703b18
Changes to make the operator test compatible with the new API
Emvlt edbb253
Change to the noise phantom to make it array-API compatible
Emvlt b9f8f76
Minor change to the directional_derivative of the Divergence Operator…
Emvlt bdd19e6
Removing the deprecated nonposx and nonposy arguments of the set_xsca…
Emvlt f1bbe8b
Change to the proximal_arg_scaling to accomodate for complex scaling …
Emvlt 724f192
Updating the examples so that they run with numpy (backward compatibi…
Emvlt 2978f3b
Minor refactoring of tests
Emvlt dbd8cf4
Adding an important clause for 3D tomo when doing the in-place transf…
Emvlt 1c878eb
Restructuring ODL hierarchy: Creating directory AND moving array_API…
Emvlt bd086ec
Make a clear distinction between the two functions called `all_equal`.
leftaroundabout 2ac7a1c
Move the `util` modules into the new `core` directory.
leftaroundabout f5d4b59
Changing odl.all_equal to all_equal
Emvlt 8144790
Move the `set` modules into the `core` directory.
leftaroundabout 3754437
Move the `space` modules into the `core` directory.
leftaroundabout b869f0a
Move the `discr` modules into the `core` directory.
leftaroundabout 3efeb14
Move the `sparse` modules into the `core` directory.
leftaroundabout 4f243bb
Move the `operator` modules into the `core` directory.
leftaroundabout 329a13f
Move the `phantom` modules into the `core` directory.
leftaroundabout 1d050be
Move the `diagnostics` modules into the `core` directory.
leftaroundabout aa6bbbb
Reintroduce a case distinction removed in e7f2c45.
leftaroundabout 46de66d
Moving the deform in the trafos folder and creating dedicated and s…
Emvlt a664948
Adjusting the test to the new repo organisation
Emvlt d05a5a0
Updating the file to reflect the trafos change
Emvlt 83a0299
Moving the folder in the folder
Emvlt e2e89cf
Moving the module out of the solvers
Emvlt adf4f01
Forgot to ammend the __init__
Emvlt a062786
Changed the test suite organisation to reflect the new repo's organis…
Emvlt 6abad0c
The largescale tests for nonsmooth solvers called the wrong api, odl.…
Emvlt f4baa91
Updated the examples
Emvlt b0e696d
Updating the to in all the documentation
Emvlt 369dce1
Addition of a dtype helper to infer the return type of the when the …
Emvlt b7f555a
Make the sparse-matrix backends absolute and cycle-free.
leftaroundabout fb6fadc
Reflect interface change of `sampling_function` in the doctests.
leftaroundabout b974388
Fixing doctests to abide to the new API
Emvlt e146e8c
Workaround for duplicate module initialization when running in PyTest.
leftaroundabout bd47b62
Minor change on the step dtype in the derivatives module.
Emvlt 44a7258
Adding a self. in front of the device variable of the to_impl call
Emvlt 18de1c7
Creation of a folder for ODL. This makes sure that the backend-speci…
Emvlt 05bbb9c
Make the wavelet operators compatible with ODL-1.0s no-implicit-NumPy…
leftaroundabout 75951d8
Allow for NumPy-scalars in arithmetic expressions like odl object + s…
leftaroundabout 08478e7
Correct import in one of the tests.
leftaroundabout f3dcfc6
Re-enable a test on `DiscrSpace` construction from plain lists.
leftaroundabout 73c99df
Start a new version of the PyTorch-module wrapper for ODL operators.
leftaroundabout bd721ab
Ongoing rewriting of the torch Operator test
Emvlt c32e8d1
Make the inner product on product spaces independent of a pre-selecte…
leftaroundabout 09bc00d
Add a forgotten import symbol.
leftaroundabout f6b7b13
Make equality checks in large-scale test NumPy-independent.
leftaroundabout 5e75af2
Short-cut `element` generation when given something that is already e…
leftaroundabout 04da9ac
Remove an unnecessary check that prevented boolean operations.
leftaroundabout a05a39e
Bring large-scale default-functionals tests in line with ODL-1.0.
leftaroundabout f67f99b
Fix in a largescale test, the ASTRA_VERSION constant is now visible u…
Emvlt 8304df7
Undo accidental removal of the PyTorch dependency in 18de1c77d.
leftaroundabout 7b28e2a
Workaround for inconsistent/nonsensical behaviour of `from_dlpack` in…
leftaroundabout 2b4e878
Add a version-specific wrapper for `from_dlpack` for torch-2.7.
leftaroundabout 1e72115
Make an assertion conditional that only makes sense on NumPy.
leftaroundabout 536c926
More simplistic workaround for PyTorch-DLPack inconsistencies.
leftaroundabout a9be53b
Allow `all_equal` to directly work on pairs of PyTorch tensors.
leftaroundabout e707c12
Enable different storage backends/devices in slow ray-trafo tests.
leftaroundabout 1e61123
Generalize a dtype case distinction beyond NumPy.
leftaroundabout cd3202c
Typo in the name of a test.
leftaroundabout a074314
Further relax type restrictions on `all_almost_equal`.
leftaroundabout ccc312d
Generalize dtype handling in slow Tensor Space tests.
leftaroundabout 93e9968
Changes to the dlpack array-API support and to the tests.
Emvlt 356e244
Edit of the non_smooth largescale tests.
Emvlt 55d5c0b
Merging from currentHEAD.
Emvlt b85cbcb
Get the new `OperatorFunction` (torch autograd wrapper) to work in fo…
leftaroundabout 1c5e5db
Setting up the sphinx pipeline
Emvlt 55a43db
Merge branch 'python_array_api_support' of github.com:Emvlt/odl into …
Emvlt bb11854
Edit on the paths of the docs
Emvlt ce1856b
Migrating the old documentation
Emvlt 80153d2
Implement batch-looping for the torch operator-wrapper.
leftaroundabout cacf277
Update the test of Torch operator wrapper towards ODL-1.0.
leftaroundabout 96dbd89
Add different impl/device combinations of ODL operator to the Torch w…
leftaroundabout f3a1481
Uniform way of naming devices between the PyTorch-module test and the…
leftaroundabout 06a5a5a
Remove the old version of the PyTorch wrapper around ODL operators.
leftaroundabout 34efabb
Attempt at making some ODL core definitions officially part of the `o…
leftaroundabout 14d857b
Some attempt to bring the guide on NumPy-interaction up to date.
leftaroundabout 9fbaf2a
Making the show_discrete_data function array-API compatible by castin…
Emvlt 0792713
Making the filtered back projection array-API compatible
Emvlt da5e647
Changing the setup.cfg file to include python_array_api
Emvlt e2bdf49
Updating the contributors and developpers
Emvlt cfa2689
Attempt at making the documentation automatically build on push
Emvlt 9ea2e82
Avoid misleading error msg about "pytorch not being supported by ODL"…
leftaroundabout ee476ae
Correct the documentation of `asarray`, reflecting the fact that it o…
leftaroundabout 0d6bb72
More documentation on the ways of converting from&to arrays.
leftaroundabout ac8f9b5
Update most of the NumPy guide.
leftaroundabout 5957b22
Update the SciPy-solver example in the guide.
leftaroundabout d9dd6c9
Add Torch to the array-interaction guide.
leftaroundabout a544072
Rewrite the guide on vectorization for ODL-1.0 / ArrayAPI
leftaroundabout c8c2c27
Commit on the documentation.
Emvlt a5331b4
Add migration guide for 1.0 to the docs.
leftaroundabout 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
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.
I don't think it makes sense for us to support string dtypes at all. Leaving those commented assertions makes it unclear what's the intention.