M
Modular•2mo ago
Vicente

Can I port my Python lib to Mojo?

I am developing a torch-based AI lib. I want to make it faster (specially the non-torch parts). Can I do a full port to Mojo amd expect it to work on Python AND Mojo?
5 Replies
ModularBot
ModularBot•2mo ago
Congrats @Vicente, you just advanced to level 1!
DobyDabaDu
DobyDabaDu•2mo ago
If u perform operations in pure python that slow down ur code then I think yes rewriting those parts in mojo may make ur code run faster. But calling torch functions from mojo repeatedly may have a worse performance than calling them directly from python. U should do some tests
DobyDabaDu
DobyDabaDu•2mo ago
In one my projects I use sklearn to generate test data then perform ml operations on those data. U can check it here: https://github.com/yetalit/Mojmelo/tree/main/tests
GitHub
Mojmelo/tests at main · yetalit/Mojmelo
Machine Learning algorithms in pure Mojo 🔥. Contribute to yetalit/Mojmelo development by creating an account on GitHub.
DobyDabaDu
DobyDabaDu•2mo ago
Take a look at a [algorithm]_test.mojo file then u'll understand how I call python functions
Vicente
VicenteOP•2mo ago
Thanks, I will check 😄
Want results from more Discord servers?
Add your server