# Introducing Nx, Lambda days 2021

**URL:** <https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663>\
**Category:** Questions\
**Tags:** nx\
**Created:** [February 19, 2021, 2:06pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663 "2021-02-19T14:06:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [February 19, 2021, 2:06pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/1 "2021-02-19T14:06:39Z")

</div>

Long expected 🙂

[![](https://img.youtube.com/vi/fPKMmJpAGWc/maxresdefault.jpg "Introducing Nx - José Valim | Lambda Days 2021") ](https://www.youtube.com/watch?v=fPKMmJpAGWc)

---

<div class="post-metadata">

**Author:** ![crova](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crova/32/25853_2.png) [@crova](https://forum.elixirforum.com/u/crova)\
**Post date:** [February 19, 2021, 5:44pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/2 "2021-02-19T17:44:47Z")

</div>

I know nothing about this subject but every time I listen to José I’m impressed by him.  
José, você é o cara !

---

<div class="post-metadata">

**Author:** ![lud](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/32/14382_2.png) [@lud](https://forum.elixirforum.com/u/lud)\
**Post date:** [February 19, 2021, 10:12pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/3 "2021-02-19T22:12:57Z")

</div>

I had absolutely zero knowledge in machine learning, and that was actually a pretty good introductory class, despite its goal being only to show Nx features.

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [February 20, 2021, 9:04pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/4 "2021-02-20T21:04:48Z")

</div>

For those having some troubles compiling EXLA on Ubuntu 20.4, I found those commands to be helpful.

```elixir
$ sudo apt install python3-pip
$ pip3 install numpy
$ cd /usr/bin
$ sudo ln -s python3 python

$ asdf plugin add bazel
$ asdf install bazel 3.1.0
$ asdf global bazel 3.1.0

```

The link is because it’s looking for python, not python3.

**UPDATE:** This is not the recommended way, see next post. It’s just a hack to get EXLA compilation working.

Bazel is also available as a plugin for asdf-vm. You need to use 3.1.0 instead of the latest 4.0.0

And now with all in place, I need to find what to do with it 🙂

---

<div class="post-metadata">

**Author:** ![lud](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/32/14382_2.png) [@lud](https://forum.elixirforum.com/u/lud)\
**Post date:** [February 20, 2021, 9:36pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/5 "2021-02-20T21:36:53Z")

</div>

For MacOs Mojave asdf wa the simplst solution for bazel too.

---

<div class="post-metadata">

**Author:** ![slouchpie](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slouchpie/32/34819_2.png) [@slouchpie](https://forum.elixirforum.com/u/slouchpie)\
**Post date:** [February 20, 2021, 11:59pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/6 "2021-02-20T23:59:59Z")

</div>

I have worked with Python for a few years and I can absolutely say this is not a good idea:

```elixir
$ # DON'T DO THIS
$ cd /usr/bin
$ sudo ln -s python3 python # :(

```

You should instead make a virtual environment and associate it with whatever directory you occupy while playing with nx.

For example, here is how I do it using `pyenv` ([GitHub - pyenv/pyenv: Simple Python version management · GitHub](https://github.com/pyenv/pyenv)):

```elixir
$ mkdir nx_fun
$ cd nx_fun
$ pyenv virtualenv 3.9-dev nx
$ pyenv local nx
$ pip install numpy

```

If you have set up `pyenv` properly then being in the `nx_fun` directory means `python` automatically points to the `python3` shim for your virtual environment.

It is dangerous to override system python files which are often used under-the {:exla, “~\> 0.1.0-dev”, github: “elixir-nx/nx”, sparse: “exla”},  
{:nx, “~\> 0.1.0-dev”, github: “elixir-nx/nx”, sparse: “nx”, override: true}-hood by a surprising number of packages. I advise never touching your system python files (let `apt` or `yum` or `apk` or `brew` handle those) and always use a virtual environment when you want to `pip install`.

The `bazel` instructions are good though. I also recommend `asdf`.

Update: I got a chance to try this and I want to add something. If using `pyenv`, you need to do `pyenv global nx` (if you followed the instructions above) in order for `mix deps.compile exla` to find numpy. I still recommend doing it this way since you can easily switch you global python version back when you are finished playing with `nx`. It’s still compiling for me… 🕐

---

<div class="post-metadata">

**Author:** ![kokolegorille](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kokolegorille/32/4784_2.png) [@kokolegorille](https://forum.elixirforum.com/u/kokolegorille)\
**Post date:** [February 21, 2021, 12:32am UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/7 "2021-02-21T00:32:40Z")

</div>

I am not a python guy, I will follow your advice 🙂

Thanks for reporting.

---

<div class="post-metadata">

**Author:** ![slouchpie](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/slouchpie/32/34819_2.png) [@slouchpie](https://forum.elixirforum.com/u/slouchpie)\
**Post date:** [February 21, 2021, 1:07pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/8 "2021-02-21T13:07:25Z")

</div>

It took 7 hours for EXLA to compile on my laptop…

---

<div class="post-metadata">

**Author:** ![patrickdm](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/patrickdm/32/7579_2.png) [@patrickdm](https://forum.elixirforum.com/u/patrickdm)\
**Post date:** [February 21, 2021, 1:52pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/9 "2021-02-21T13:52:11Z")

</div>

Ouch.. that hurts. I had to go through at least 7 attempts before successfully compiling EXLA, each time with different errors. As last hope I kept insisting on **mix compile** and then after three rounds of it I could get it compiled.  
I’m on Ubuntu 20.04, the successfull compilation attempt used **bazel 3.2.0** through **bazelisk** (installed with npm) and I used **python\_is\_python3** apt package to alias python.  
An attempt to compile with cuda support destroyed a first successful build (😱) and I had to try half the afternoon to get it compiled back again. The compilation process takes about 20 minutes on my machine.

---

<div class="post-metadata">

**Author:** ![seanmor5](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/seanmor5/32/20610_2.png) [@seanmor5](https://forum.elixirforum.com/u/seanmor5)\
**Post date:** [February 21, 2021, 6:38pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/10 "2021-02-21T18:38:53Z")

</div>

Hi,

If you all can report to me some of your compilation problems and troubleshoot steps, I can put together a comprehensive guide for building EXLA so there are no more issues. Also please note that we fortunately no longer have the NumPy dependency 🙂

---

<div class="post-metadata">

**Author:** ![lud](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/32/14382_2.png) [@lud](https://forum.elixirforum.com/u/lud)\
**Post date:** [February 22, 2021, 10:30am UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/11 "2021-02-22T10:30:45Z")

</div>

Is there a good article about the mechanisms used in the demo? Why do we use `dot`, why is the `loss` function implemented that way, why the `grad` is implemented that way, etc. And why do we add a single hidden layer, and why we add it, etc.

I can find a lot of tutorials that explains how to code it, just as José did, but not an article that explains the choices in a not-too-complicated way. Then there are the hard-math papers. I mean I am not a maths person ; I don’t mind diving into maths when it is necessary but all docs I found expect me to be able to reduce integrals and multiply matrices like I breathe.

I understand that maybe this topic assumes the developers have a decent math knowledge, but in the end, the code is able to predict numbers (i.e. it works) with just 2-3 math functions so that should not be that hard to grasp with a good explanation.

---

<div class="post-metadata">

**Author:** ![joddm](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/j/3ec8ea/32.png) [@joddm](https://forum.elixirforum.com/u/joddm)\
**Post date:** [February 22, 2021, 1:14pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/12 "2021-02-22T13:14:26Z")

</div>

[Neural Networks and Deep Learning](http://neuralnetworksanddeeplearning.com/) by Michael Nielsen is a good primer.

Chapter 1 (Using neural nets to recognize handwritten digits) walks through the specific use case on the MNIST dataset (with code near the bottom of the page).

---

<div class="post-metadata">

**Author:** ![seanmor5](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/seanmor5/32/20610_2.png) [@seanmor5](https://forum.elixirforum.com/u/seanmor5)\
**Post date:** [February 22, 2021, 1:50pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/13 "2021-02-22T13:50:55Z")

</div>

If you like math and don’t mind reading a textbook:

- [Deep Learning Book](https://deeplearningbook.org)
- [Pattern Recognition and Machine Learning](https://www.amazon.com/Pattern-Recognition-Learning-Information-Statistics/dp/0387310738)

If you don’t like math and you’d rather learn to the programming concepts:

- [Dive into Deep Learning](https://d2l.ai)
- [Deep Learning in Python](https://www.manning.com/books/deep-learning-with-python)

Or if you’re willing to wait we can put some resources out there with explanations of Nx code 🙂

---

<div class="post-metadata">

**Author:** ![lud](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lud/32/14382_2.png) [@lud](https://forum.elixirforum.com/u/lud)\
**Post date:** [February 22, 2021, 3:26pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/14 "2021-02-22T15:26:59Z")

</div>

Thank you @joddm this look perfect.

@seanmor5 Thank you for the links, I will look into it. I am absolutely willing to wait for resources but I am not sure I understand your comment correctly. I’ve coded along with José while watching the video (with a two hours pause to compile XLA before the end 😃 ) and it was easy ; because of the great work you made with him, the library is really easy to use. But as José said in the video disclaimer, the video was not about the underlying concepts, and he would not explain the choices of mathematical functions (except maybe for the softmax wich is easy to get). So now If you’re saying that you want to put resources to explain that, yes, I’ll wait anytime.

---

<div class="post-metadata">

**Author:** ![gregvaughn](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gregvaughn/32/954_2.png) [@gregvaughn](https://forum.elixirforum.com/u/gregvaughn)\
**Post date:** [February 22, 2021, 5:46pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/15 "2021-02-22T17:46:57Z")

</div>

I’ll add one more book recommendation. I gave it a quick read-through last year and it helps with the overall concepts. I need to go back through it and work examples to get them to stick in my brain now.

> **[Programming Machine Learning](https://www.pragprog.com/titles/pplearn/programming-machine-learning/)**
>
> A zero-to-hero machine learning tutorial for software developers, from simple programs to deep learning.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/astonj/32/15_2.png) [@AstonJ](https://forum.elixirforum.com/u/AstonJ)\
**Post date:** [February 22, 2021, 6:02pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/16 "2021-02-22T18:02:46Z")

</div>

There’s also currently an interview and AMA with the author over on Devtalk - anyone commenting/taking part in the thread will get entered into a draw where the winner can win of his books :003:

> **[Spotlight: Paolo Perrotta (Author)](https://forum.devtalk.com/t/spotlight-paolo-perrotta-author/6868)**
>
> “A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles? More importantly, is making the switch from short-form to long-form worth the effort? Discover how Paolo...

(He’s also the author of Metaprogramming Ruby which I thought was an amazing book and incredibly well written!)

---

<div class="post-metadata">

**Author:** ![bdarla](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bdarla/32/19471_2.png) [@bdarla](https://forum.elixirforum.com/u/bdarla)\
**Post date:** [February 22, 2021, 7:30pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/17 "2021-02-22T19:30:21Z")

</div>

I really loved reading this book! Perfect for beginners!

---

<div class="post-metadata">

**Author:** ![drl123](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/drl123/32/8307_2.png) [@drl123](https://forum.elixirforum.com/u/drl123)\
**Post date:** [February 22, 2021, 10:05pm UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/18 "2021-02-22T22:05:25Z")

</div>

Turns out this is one of the titles that Prag Prog has published on [medium.com](http://medium.com). You can read it for free with your medium membership: [https://medium.com/pragmatic-programmers/table-of-contents-5dd5f8458f77](https://medium.com/pragmatic-programmers/table-of-contents-5dd5f8458f77).

---

<div class="post-metadata">

**Author:** ![LukeWood](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lukewood/32/17097_2.png) [@LukeWood](https://forum.elixirforum.com/u/LukeWood)\
**Post date:** [February 25, 2021, 6:24am UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/19 "2021-02-25T06:24:47Z")

</div>

Interesting… some serious potential for expressive neural network definition here.

Not sure if I’ll be using it in the near future as the tooling built for pytorch/tf is pretty well developed - but I’ll certainly be keeping an eye out Nx 🙂

---

<div class="post-metadata">

**Author:** ![kip](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kip/32/1440_2.png) [@kip](https://forum.elixirforum.com/u/kip)\
**Post date:** [February 26, 2021, 9:05am UTC](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663/20 "2021-02-26T09:05:46Z")

</div>

I’m excited to see the work by @versilov on [torchx](https://github.com/elixir-nx/nx/pull/281#pullrequestreview-599321494) since if my reading is correct, this opens up some exciting opportunties for text analysis which would help reinvigorate the work on my [text](https://github.com/kipcole9/text) library.

[Next page](https://forum.elixirforum.com/t/introducing-nx-lambda-days-2021/37663.md?page=2)
