function batchImages(imagesData) {
  const numImages = imagesData.length;
  const flat = [];
  for (let i = 0; i < numImages; i++) {
    const image = imagesData[i];
    for (let j = 0; j < image.length; j++) {
      flat.push(image[j]);
    }
  }

  const batchedTensor =
      tf.tensor3d(flat, [numImages, IMAGE_WIDTH, IMAGE_HEIGHT], 'float32');

  return batchedTensor;
}
Take an array of images (represented as typedarrays) and return
a tensor representing them.

@param {Float32Array[]} imagesData

@returns {Tensor3d} tensor of input images