Using the basic GAN model

In the runMNISTModel method, we first prepare a random input to the model:

void runMNISTModel() {    float[] floatValues = new float[BATCH_SIZE*100];    Random r = new Random();    for (int i=0; i<BATCH_SIZE; i++) {        for (int j=0; i<100; i++) {            double sample = r.nextGaussian();            floatValues[i] = (float)sample;        }    }

Then feed the input to the model, run the model and gets the output values, which are scaled grayscale values between 0.0 and 1.0, and convert them to integers in the range of 0 and 255:

    float[] outputValues = new float[BATCH_SIZE * 28 * 28];    AssetManager assetManager = getAssets();    mInferenceInterface = new TensorFlowInferenceInterface(assetManager, MODEL_FILE1); mInferenceInterface.feed(INPUT_NODE1, floatValues, ...

Get Intelligent Mobile Projects with TensorFlow now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.