Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Java Inference API will be a wrapper around the high level Scala Inference interface. An exampleThe Java interface needs to be a high level interface which supports loading a model and doing forward passes. Additionally, there should be support for RNN modelsHere is an example of what the Java wrapper will look like for the Scala inference Predictor class.

Code Block
languagejava
titleLoadModel
/**
 * Implementation of prediction routines.
 *
 * @param modelPathPrefix     Path prefix from where to load the model artifacts.
 *                            These include the symbol, parameters, and synset.txt
 *                            Example: file://model-dir/resnet-152 (containing
 *                            resnet-152-symbol.json, resnet-152-0000.params, and synset.txt).
 * @param inputDescriptors    Descriptors defining the input node names, shape,
 *                            layout and type parameters
 *                            <p>Note: If the input Descriptors is missing batchSize
 *                            ('N' in layout), a batchSize of 1 is assumed for the model.
 * @param contexts            Device contexts on which you want to run inference; defaults to CPU
 * @param epoch               Model epoch to load; defaults to 0

 */
Predictor(String modelPathPrefix: String, Array<DataDesc> inputDescriptors,
                Array[Context] Contexts, int epoch)

...