ds604
Use Nx operators in Livebook?
I’m relatively new to Elixir, but have been reading about translating to Nx from Numpy/PyTorch:
From Python to Elixir Machine Learning
Matrix multiplication from foundations
I was thinking that it would be helpful to be able to play around with Nx in Livebook. What I want is to be able to have the operators available, in the manner that they are available to defn functions, so that I can write in Livebook in a straightforward mathematical style (like Matlab). This is possible by having the module definition in a cell, with import Nx.Defn at the top:
But I am limited to working within this one cell. If I go outside of this cell, then I have to revert to using the pipeline style:
The way I can think to get what I want would be to wrap multiple cells in a module definition:
Then within this context, I’m working in “Matlab mode”. I’m wondering if this is currently possible by some means in Livebook? Or if not, maybe there’s some metaprogramming means of achieving this? I’m still reading up on Elixir basics, so it’s certainly possible I’m missing some fundamental understanding about how things work…
Thanks!
Most Liked
jonatanklosko
jonatanklosko
There is a view configuration in the bottom-right corner:
Code zen only shows dense code cells. You can also use “Custom” and show both Markdown and Code cells, it is going to hide the insert buttons, so things will be more dense. In those modes, you can still insert cells using the keyboard shortcuts : )
03juan
Are you referring to the various smart cells you can add to the livebook?
Those are kino components and because of the modular nature of the design they are each a self-contained library comparable to micro-frontends, so each manages its own style, e.g. kino_bumblebee css, kino_explorer css, kino_db css
Also, welcome to the community!
Popular in Questions
Other popular topics
Latest Livebook Threads
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance












