@@ -24,9 +24,10 @@ First we create an "image" tensor composed entirely of pixel value [42](https://
2424``` scala
2525import java .nio .file .{Files , Paths }
2626import org .emergentorder .onnx .Tensors ._
27+ import org .emergentorder .onnx .Tensors .Tensor ._
2728import org .emergentorder .onnx .backends ._
2829import org .emergentorder .compiletime ._
29- import io .kjaer .compiletime ._
30+ import org . emergentorder . io .kjaer .compiletime ._
3031
3132val squeezenetBytes = Files .readAllBytes(Paths .get(" squeezenet1.0-12.onnx" ))
3233val squeezenet = new ORTModelBackend (squeezenetBytes)
@@ -57,16 +58,18 @@ val out = squeezenet.fullModel[Float,
5758// val out:
5859// Tensor[Float,("ImageNetClassification",
5960// "Batch" ##: "Class" ##: TSNil,
60- // 1 #: 1000 #: SNil)] = (Array(0.8230729,
61+ // 1 #: 1000 #: 1 #: 1 SNil)] = IO(...)
6162// ...
6263
6364// The output shape
64- out.shape
65- // val res0: Array[Int] = Array(1, 1000)
65+ out.shape.unsafeRunSync()
66+ // val res0: Array[Int] = Array(1, 1000, 1, 1 )
6667
68+ val data = out.data.unsafeRunSync()
69+ // val data: Array[Float] = Array(1.786191E-4, ...)
6770
6871// The highest scoring and thus highest probability (predicted) class
69- out. data.indices.maxBy(out. data)
72+ data.indices.maxBy(data)
7073// val res1: Int = 549
7174```
7275
0 commit comments