List of usage examples for org.deeplearning4j.datasets.iterator.impl MnistDataSetIterator MnistDataSetIterator
public MnistDataSetIterator(int batch, int numExamples) throws IOException
From source file:org.nd4j.examples.RunGraphExample.java
License:Apache License
public static void main(String... args) throws Exception { //input name (usually with place holders) List<String> inputs = Arrays.asList("flatten_2_input"); //load the graph from the classpath byte[] content = IOUtils.toByteArray(new ClassPathResource("Mnist/mnist.pb").getInputStream()); DataSetIterator dataSetIterator = new MnistDataSetIterator(1, 1); INDArray predict = dataSetIterator.next().getFeatures(); //run the graph using nd4j try (GraphRunner graphRunner = new GraphRunner(content, inputs)) { Map<String, INDArray> inputMap = new HashMap<>(); inputMap.put(inputs.get(0), predict); Map<String, INDArray> run = graphRunner.run(inputMap); System.out.println("Run result " + run); }//from w ww. j a v a 2 s . c o m }