August 2024
Intermediate to advanced
374 pages
8h 44m
English
Now that you have a better understanding of what a tensor is, it’s time to get a better understanding of how to manipulate tensors.
Nx comes with a number of operations you can use and compose into complex mathematical operations and algorithms. There are four common types of operations you should get comfortable with first: shape and type operations, element-wise unary operations, element-wise binary operations, and reductions.
Shape and type operations work on the shape and type properties of a tensor. Run the following code in a Livebook cell to create a new tensor with shape {3} and type {:s, 64}:
| | a = Nx.tensor([1, 2, 3]) |
Then, run the following code to cast the tensor to type {:f, 32} and change ...
Read now
Unlock full access