arogozhnikov / einops

Flexible and powerful tensor operations for readable and reliable code (for pytorch, jax, TF and others)
https://einops.rocks
MIT License
8.54k stars 352 forks source link

support mindspore #323

Closed lvyufeng closed 2 months ago

lvyufeng commented 5 months ago

after almost 2 years, I have to make this pull request again since many ML/DL repos need einops to construct the model. I can maintain the MindSpore support as community developer(same as oneflow/tinygrad).

FYI, the einsum operator in MindSpore only support GPU currently, but I have patched them in MindNLP(https://github.com/mindspore-lab/mindnlp) to support other devices(CPU/NPU)

arogozhnikov commented 2 months ago

Hi Nate,

(all PRs were closed yestrday automatically because of branch switch master -> main).

A bit of previous context and my experience:

Every time I get back to work on einops, at least one of frameworks had broken something in framework (installation method is broken, CPU support is absent in release, even some bugs in their operations / conversions). This means I need to spend time debugging, reporting and then it takes them months to fix, while it should've taken hours at best.

Since there is nothing to fix on einops side, I end up just turning off backend in CI (and that's not great).

Even commits from framework maintainers did not guarantee prompt response from their side.


So I am switching testing model from 'einops tests all integrations' to 'framework tests its integration against einops'.

This makes more sense because these tests are apparently good at detecting problems in frameworks (you can find testing details in the README)


Array API is new reality and I ask developers to just implement API because other tools (e.g. sklearn) can use this API too.


If there is still interest in having layers for framework (they can't be provided via array API) and einsum, I will accept a PR if einops tests are run in framework CI, so that framework took care about tehese problems before release, not after.

I hope my motivation is clear: things should be tested, and team behind framework should be involved in this process.