liveBook · Manning

NumPy

As explained in Deep Learning with JAX

A Python library for array-based numerical computing.

NumPy is Python’s standard workhorse for numerical computing with multidimensional arrays. Its array structure represents data such as images naturally, while its API supplies familiar operations for processing that data. section 1.2.1 section 3.1.1

A NumPy image array can be understood through a few practical properties:

  • Use dimensions for spatial coordinates and color channels; a color image commonly has height, width, and three color values. section 3.1.1
  • Inspect ndim, shape, size, and nbytes to understand an array’s rank, dimensions, element count, and memory footprint. section 3.1.1
  • Use NumPy operations in pipelines that load, preprocess, transform, filter, and save numerical data. section 3.1

Inspecting an image array

After loading an image with scikit-image, checking img.ndim can return 3, img.shape can return (667, 500, 3), and img.size can return 1000500. These values reveal the array’s three dimensions and total elements. NumPy can then be replaced by jax.numpy in many programs, although JAX requires functional updates instead of common in-place operations such as arr[i] += 10. section 3.1.1 section 1.2.1

Figure 3.1 An example of image processing we want to implement

Use the image-processing figure to connect a visual denoising task with its underlying multidimensional array representation. section 3.1

How Deep Learning with JAX covers it

How deep it goes
Explains the array API and image-array properties through a worked pipeline, while deferring several NumPy–JAX differences.
Examples
Uses denoising an image, loading a photo, inspecting shape and rank, and comparing NumPy code with jax.numpy.
What it assumes
Assumes Python familiarity while developing array and tensor intuition through an accessible image-processing task.
What you can do after
Apply it via NumPy arrays to represent images, inspect their structure, and build basic numerical-processing pipelines.
How it connects
Connects NumPy with JAX, tensors, multidimensional arrays, image processing, and scikit-image.

Also explained in

Compare how 7 books explain NumPy →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with JAX. The section links point to the parts of the book it draws on.