imageDataTo3DTensor = (imageData, width, height, normalize=true) => {
  // Create array placeholder for the 3d array
  let imageArray = tf.fill([width, height, 3], 0).arraySync();

  // Iterate through the data to fill out channel arrays above
  for (let i = 0; i < imageData.length; i++) {
    let pixelIndex = Math.floor(i / 4),
      channelIndex = i % 4,
      row = width === height ? Math.floor(pixelIndex / width)
                              : pixelIndex % width,
      column = width === height ? pixelIndex % width
                              : Math.floor(pixelIndex / width);
    
    if (channelIndex < 3) {
      let curEntry  = imageData[i];
      // Normalize the original pixel value from [0, 255] to [0, 1]
      if (normalize) {
        curEntry /= 255;
      }
      imageArray[row][column][channelIndex] = curEntry;
    }
  }

  // If the image is not 64x64, crop and or pad the image appropriately.
  if (width != networkInputSize && height != networkInputSize) {
    imageArray = cropCentralSquare(imageArray)
  }

  let tensor = tf.tensor3d(imageArray);
  return tensor;
}
Convert canvas image data into a 3D tensor with dimension [height, width, 3].
Recall that tensorflow uses NHWC order (batch, height, width, channel).
Each pixel is in 0-255 scale.

@param {[int8]} imageData Canvas image data
@param {int} width Canvas image width
@param {int} height Canvas image height