Significantly speed up your NumPy operations using Tensorflow and its new NumPy API
NumPy (Numerical Python) is the most popular Python library in the Data Science world. Countless other Python modules are based on NumPy, as it provides a powerful API for working with arrays and several other operations, covering branches of mathematics like linear algebra and Fourier transform. As an attribution, NumPy was created in 2005 by Travis Oliphant and it is one of the most active open-source projects.
In this story, we take NumPy a step further, increasing its execution speed using TensorFlow. This allows running NumPy code on GPU, accelerated by TensorFlow, while also allowing access to all of TensorFlow’s APIs.
But why should we use NumPy? In Python, we have lists that serve the purpose of arrays. You can always write a matrix multiplication algorithm using Python lists and a few
for loops. Well, although you can do it doesn't mean you should.
NumPy aims to provide an array object that is up to 50x faster than traditional Python lists. In NumPy, this object is called
ndarray and it’s the basic building block on the library. However, in this story, we take it a step further, increasing the speed of NumPy using TensorFlow.
As of TF 2.4, TensorFlow implements a subset of the NumPy API, available as tf.experimental.numpy. This allows running NumPy code on GPU, accelerated by TensorFlow, while also allowing access to all of TensorFlow's APIs. So, let’s go through the TF NumPy API step by step.
Learning Rate_ is my weekly newsletter for those who are curious about the world of AI and MLOps. You’ll hear from me every Friday with updates and thoughts on the latest AI news, research, repos and books. Subscribe here!
In this post, we'll learn Tensorflow-Numpy Model. Surprises are waiting for you.
Learn numpy features to see why you should use numpy - high performance, multidimensional container, broadcasting functions, working with varied databases
Learn the uses of numpy - Alternate for lists in python, multi dimensional array, mathematical operations. See numpy applications with python libraries.
Numpy is by far the most used library for performing math operations on arrays. So you know run your numpy operations on GPU using Tensorflow Numpy API?
In this video, I'll show you how you can accelerate NumPy operations using Tensorflow and GPU's by using Tensorflow's tf.experimental.numpy Module.