Going from def to defn

So far in this chapter, you’ve learned about what a tensor is, how to create and manipulate tensors in Nx, and how to model the real world with tensors. This is all great, but you still haven’t learned how to unlock the true power of Nx just yet.

If you’ve been working with Elixir for a while, you’ve probably heard the argument Elixir and the Erlang Virtual Machine aren’t designed for the type of computations required in machine learning and scientific computing. All the examples you’ve seen in this chapter run in pure Elixir without any acceleration. The lack of acceleration is fine for the examples in this chapter, but for the computations required in machine learning, you’ll need acceleration. Enter the magic of

Get Machine Learning in Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.