Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Added method comments on Predictor.predict with Array[Double] as a po…
Browse files Browse the repository at this point in the history
…ssible input
  • Loading branch information
piyushghai committed Jan 10, 2019
1 parent b7f851e commit e329ee4
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ class Predictor private[mxnet] (val predictor: org.apache.mxnet.infer.Predictor)
predictor.predict(input).toArray
}

/**
* Takes input as Array of one dimensional arrays and creates the NDArray needed for inference
* The array will be reshaped based on the input descriptors. Example of calling in Java:
*
* <pre>
* {@code
* double tmp[][] = new double[1][224];
* for (int x = 0; x < 1; x++)
* for (int y = 0; y < 224; y++)
* tmp[x][y] = (int)(Math.random()*10);
* predictor.predict(tmp);
* }
* </pre>
*
* @param input: An Array of a one-dimensional array.
An extra Array is needed for when the model has more than one input.
* @return Indexed sequence array of outputs
*/

def predict(input: Array[Array[Double]]):
Array[Array[Double]] = {
predictor.predict(input).toArray
Expand Down

0 comments on commit e329ee4

Please sign in to comment.