Skip to content

Commit bb772d5

Browse files
committed
Use cases section: add "Python API for xtensor" use case
1 parent f6dc911 commit bb772d5

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

spec/use_cases.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,32 @@ Hence the complete `einops` code base could be close to 50% smaller, and easier
143143
[Unumpy](https://github.com/Quansight-Labs/unumpy) and
144144
[EagerPy](https://github.com/jonasrauber/eagerpy). Many end users and organizations will also have such glue code - it tends to be needed whenever one tries to support multiple
145145
array types in a single API.
146+
147+
148+
### Use case 3: adding a Python API to xtensor
149+
150+
[xtensor](https://github.com/xtensor-stack/xtensor) is a C++ array library
151+
that is NumPy-inspired and provides lazy arrays. It has Python (and Julia and R)
152+
bindings, however it does not have a Python array API.
153+
154+
Xtensor aims to follow NumPy closely, however it only implements a subset of functionality
155+
and documents some API differences in
156+
[Notable differences with NumPy](https://xtensor.readthedocs.io/en/latest/numpy-differences.html).
157+
158+
Note that other libraries document similar differences, see for example
159+
[this page for JAX](https://jax.readthedocs.io/en/latest/jax.numpy.html) and
160+
[this page for TensorFlow](https://www.tensorflow.org/guide/tf_numpy).
161+
162+
Each time an array library author designs a new API, they have to choose (a)
163+
what subset of NumPy makes sense to implement, and (b) where to deviate
164+
because NumPy's API for a particular function is suboptimal or the semantics
165+
don't fit their execution model.
166+
167+
This array API standard aims to provide an API that can be readily adopted,
168+
without having to make the above-mentioned choices.
169+
170+
.. note::
171+
172+
XND is another array library, written in C, that still needs a Python API.
173+
Array implementations in other languages are often in a similar situation,
174+
and could translate this array API standard 1:1 to their language.

0 commit comments

Comments
 (0)