liveBook · Manning

Rank-4 tensor

As explained in Deep Learning with R, Third Edition

A rank-4 tensor is a tensor with four dimensions, formed by stacking rank-3 tensors along an additional dimension.

A rank-4 tensor has four dimensions. It is formed by stacking rank-3 tensors along an additional dimension, producing a higher-dimensional array of numbers. section 2.2.4

Images in a batch

Image data commonly uses rank-4 tensors with shape (samples, height, width, channels). Each sample is a two-dimensional pixel grid, and each pixel is represented by a vector of channel values. section 2.2.8

Use the axes to distinguish the data structure:

  • samples identifies the images collected together. section 2.2.8
  • height and width identify each image's pixel grid. section 2.2.8
  • channels identify the values associated with each pixel. section 2.2.8
  • Video data adds another dimension, becoming rank 5 with shape (samples, frames, height, width, channels). section 2.2.8
Figure 2.3 A rank-4 image data tensor
figure

Use the figure to visualize how image samples, pixels, and channels occupy the four axes. section 2.2.8

How Deep Learning with R, Third Edition covers it

How deep it goes
Defines rank-4 construction and image shape, then stops short of implementation details beyond tensor-axis interpretation.
Examples
Uses image batches shaped as (samples, height, width, channels) and contrasts them with video tensors containing frames.
What it assumes
Builds from rank-3 tensors and assumes only the idea that dimensions organize numerical data.
What you can do after
Evaluate image data layouts by identifying sample, spatial, and channel axes.
How it connects
Connects rank-3 tensors to images and extends the same stacking idea toward rank-5 tensors for video.

Related concepts

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