Reshaping

Reshape image data from the basic 2-D matrix format into NHWC format.

Chapter Goals:

  • Learn about NHWC format
  • Reshape the input data to NHWC

A. NHWC format

As mentioned in the previous chapter, inputs has shape (batch_size, self.input_dim**2). However, in order to use the data with our convolutional neural network, we need to get it into NHWC format.

NHWC format has a shape with four dimensions:

  1. Number of image data samples (batch size)
  2. Height of each image
  3. Width of each image
...