Replies: 1 comment
-
I referenced this discussion over here in a feature request: #1515
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be great to build a Mojo implementation of the Python array API standard, that would be usable both from Python (after creation of a Python package with AOT compilation) and from Mojo.
This API standard has been designed to be friendly with tools relying on a static language. For example, the types never depends on the run time values (in contrast to Numpy).
I realize that it is a huge work but it could worth it from the point of view of Python interoperability and partial migration towards Mojo. Having such library would significantly help users to migrate their Python code using Numpy (and other libraries using this standard, at least TensorFlow, PyTorch, MXNet, JAX, Dask and CuPy) towards Mojo.
Of course, in Mojo the arrays would just be native Mojo objects (without interaction with the Python interpreter) so that Mojo can have the opportunity to obtain decent performance with such code.
Note that there is a test suite for array libraries adopting the Python Array API standard.
Note: of course a goal of "copy-paste in Mojo your Python array API standard code and it works" would be nice.
However, I'm still puzzled with the difference of semantic of the assign operator (reference creation in Python and copy in Mojo) and I don't see how one can create a Mojo type which is not copied during an assignment (which might not be a good idea anyway).The mainarray
struct can be a reference to a container struct to mimic Python behavior (example here)Note: of course a good thing for this potential project is that Mojo would be a very good tool to implement this standard, in particular with
from tensor import Tensor, TensorSpec, TensorShape
.Beta Was this translation helpful? Give feedback.
All reactions