If you have used Python for any data processing, you have most likely used NumPy (short for Numerical Python). It provides a rich arsenal of complex data types and efficient matrix manipulation functions. Its C-accelerated implementation of vectorisable functions has earned it its reputation for processing n-dimensional array at lightning speed. But can we go faster than that?

NumPy’s C-accelerated implementation of vectorisable functions enables us to efficiently process large multi-dimensional arrays

In comes, TensorFlow’s take on NumPy API.

Thanks to TensorFlow’s GPU acceleration, we can now run NumPy situationally even faster than we can already — faster than lightning. What’s also better is that Tensorflow’s NumPy is also intra-operatable with TensorFlow’s APIs and the original NumPy API. That means we can pass TensorFlow’s ndarray to other Tensorflow functions under tf.linalgtf.datatf.kerastf.signal, etc. We can even further distribute our workload with tf.distribute.

TensorFlow’s NumPy API attempts to speed up NumPy by accelerating it with GPUs alongside with the benefit of being able to access other TensorFlow API

Note: This is still an experimental API from Tensorflow so do expect (significant) changes in the (near) future.

In this blog, we are going to take a look exactly how much faster, and under what scenario should we be using Numpy or TensorFlow. We will look into 4 very common usecases for Numpy that we as data scientists, software engineer or machine learning practicioner will be using on a daily basis:

  1. Sorting
  2. Linear Algebra
  3. Mathematical Function
  4. Fast Fourier Transform

#machine-learning #data-science #artificial-intelligence #numpy

TensorFlow: Accelerate NumPy with GPUs
14.25 GEEK