function deprocessImage(x) {
  return tf.tidy(() => {
    const {mean, variance} = tf.moments(x);
    x = x.sub(mean);
    // Add a small positive number (EPSILON) to the denominator to prevent
    // division-by-zero.
    x = x.div(tf.sqrt(variance).add(tf.backend().epsilon()));
    // Clip to [0, 1].
    x = x.add(0.5);
    x = tf.clipByValue(x, 0, 1);
    x = x.mul(255);
    return tf.clipByValue(x, 0, 255).asType('int32');
  });
}
Center and scale input image so the pixel values fall into [0, 255].