code: public void normalizeCifar(File fileName) {
          DataSet result = new DataSet();
          result.load(fileName);
          if (!meanStdStored && train) {
              uMean = Math.abs(uMean / numExamples);
              uStd = Math.sqrt(uStd);
              vMean = Math.abs(vMean / numExamples);
              vStd = Math.sqrt(vStd);
              // TODO find cleaner way to store and load (e.g. json or yaml)
              try {
                  FileUtils.write(meanVarPath, uMean + "," + uStd + "," + vMean + "," + vStd);
              } catch (IOException e) {
                  e.printStackTrace();
              }
              meanStdStored = true;
          } else if (uMean == 0 && meanStdStored) {
              try {
                  String[] values = FileUtils.readFileToString(meanVarPath).split(",");
                  uMean = Double.parseDouble(values[0]);
                  uStd = Double.parseDouble(values[1]);
                  vMean = Double.parseDouble(values[2]);
                  vStd = Double.parseDouble(values[3]);
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          for (int i = 0; i < result.numExamples(); i++) {
              INDArray newFeatures = result.get(i).getFeatures();
              newFeatures.tensorAlongDimension(0, new int[] {0, 2, 3}).divi(255);
              newFeatures.tensorAlongDimension(1, new int[] {0, 2, 3}).subi(uMean).divi(uStd);
              newFeatures.tensorAlongDimension(2, new int[] {0, 2, 3}).subi(vMean).divi(vStd);
              result.get(i).setFeatures(newFeatures);
          }
          result.save(fileName);
      }
docs: Normalize and store cifar based on successful Torch approach by Sergey Zagoruyko
  Reference: <a href="https://github.com/szagoruyko/cifar.torch">https://github.com/szagoruyko/cifar.torch</a>