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

Commit

Permalink
fix ssd
Browse files Browse the repository at this point in the history
  • Loading branch information
lanking520 committed Dec 4, 2018
1 parent 6497575 commit 5086170
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,17 @@ class Classifier(modelPathPrefix: String,
: IndexedSeq[IndexedSeq[(String, Float)]] = {

// considering only the first output
val predictResultND: NDArray = predictor.predictWithNDArray(input)(0)
val predictResultND: NDArray =
predictor.predictWithNDArray(input)(0).asInContext(Context.cpu())

val predictResult: ListBuffer[Array[Float]] = ListBuffer[Array[Float]]()

// iterating over the individual items(batch size is in axis 0)
for (i <- 0 until predictResultND.shape(0)) {
(0 until predictResultND.shape(0)).toVector.par.foreach( i => {
val r = predictResultND.at(i)
predictResult += r.toArray
r.dispose()
}
})

var result: ListBuffer[IndexedSeq[(String, Float)]] =
ListBuffer.empty[IndexedSeq[(String, Float)]]
Expand Down

0 comments on commit 5086170

Please sign in to comment.