Often times you want to slice and index into specific parts of a tensor. Nx offers a few different slicing and indexing routines which allow you to accomplish most of what you would want to do. Slicing can be a bit tricky given static shape requirements, but you usually can work around limitations. First, you … Continue reading Nx Tip of the Week #14 – Slicing and Indexing
Tag: nx totw
Nx Tip of the Week #9 – Window Functions
With the release of Nx 0.1.0, I thought I should continue these posts. My time is a limited so these will be a little more brief than before. Each week I'll highlight a small aspect of the Nx API with some code examples. When you first get started with an array programming library like Nx … Continue reading Nx Tip of the Week #9 – Window Functions
Nx Tip of the Week #6 – Compiler or Backend?
I've recently seen some confusion with respect to compilers and backends. This post is intended to clear up some of that confusion. TLDR: If performance matters, benchmark and decide. If you need flexibility or want to prototype quickly and not sacrifice speed, backends are a good choice. If you need AOT compilation or your programs … Continue reading Nx Tip of the Week #6 – Compiler or Backend?
Nx Tip of the Week #5 – Named Tensors
Note: The original named tensors article, Tensor Considered Harmful, goes through these details in much more detail and explains much better than I can. I recommend reading that as well. One of my biggest frustrations when working with NumPy and TensorFlow comes when working with axes. Take for example, this TensorFlow implementation of the Mean … Continue reading Nx Tip of the Week #5 – Named Tensors
Nx Tip of the Week #4 – Using Keywords
Numerical definitions can only accept tensors or numbers as positional arguments; however, you can get around this inflexibility using keyword lists. You can pass and use optional keyword arguments in your numerical definitions with the keyword! method. Let's take a look at some ways this might be useful. Parameter Initializers In many ML applications, you … Continue reading Nx Tip of the Week #4 – Using Keywords
Nx Tip of the Week #3 – Many Ways to Create Arrays*
*tensors In Nx, the fundamental type is the Tensor. You can think of a tensor as a multi-dimensional array, like the numpy.ndarray. For Elixir programmers, it's easy to think of Nx.Tensor as a list, or a list-of-lists, or a list-of-lists-of-lists, ... and so on. This thought process is fine, but it might lead you to … Continue reading Nx Tip of the Week #3 – Many Ways to Create Arrays*
Nx Tip of the Week #1 – Using transforms
Note: This is an idea I had after learning a significant amount from the abseil C++ Tips of the Week during my work on EXLA. I'll keep writing them as long as there's interest. If there's anything in particular you'd like to read about, feel free to let me know! Nx is an exciting new … Continue reading Nx Tip of the Week #1 – Using transforms