
Now available: Run JAX on Gradient Notebooks
Follow this guide to learn about the JAX library, and learn how to directly implement it in Gradient.
Follow this guide to learn about the JAX library, and learn how to directly implement it in Gradient.
We cover basic mistakes that can lead to unnecessary copying of data and memory allocation in NumPy. We further cover NumPy internals, strides, reshaping, and transpose in detail.
In this part we'll see how to speed up an implementation of the k-means clustering algorithm by 70x using NumPy. We cover how to use cProfile to find bottlenecks in the code, and how to address them using vectorization.
In Part 1 of our series on writing efficient code with NumPy we cover why loops are slow in Python, and how to replace them with vectorized code. We also dig deep into how broadcasting works, along with a few practical examples.