diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-04 13:30:37 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-04 13:30:37 +0100 |
commit | 85c6ece110e284cc84b85eb5a206d7bead458ab4 (patch) | |
tree | a1f7399600656c9bac04dfd15b9e2fc6f35e0fa0 /model-integration/src/test | |
parent | 350078dd5069bca24ba75d7f2010fc68ac7dd622 (diff) |
Leave the existing interface as is and add 2 accessors for accessing the tensors directly.
Diffstat (limited to 'model-integration/src/test')
3 files changed, 12 insertions, 12 deletions
diff --git a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/OnnxMnistSoftmaxImportTestCase.java b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/OnnxMnistSoftmaxImportTestCase.java index c1c798117b3..7fb167ee6f1 100644 --- a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/OnnxMnistSoftmaxImportTestCase.java +++ b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/OnnxMnistSoftmaxImportTestCase.java @@ -21,15 +21,15 @@ public class OnnxMnistSoftmaxImportTestCase { ImportedModel model = new OnnxImporter().importModel("test", "src/test/models/onnx/mnist_softmax/mnist_softmax.onnx").asNative(); // Check constants - assertEquals(2, model.largeConstants().size()); + assertEquals(2, model.largeConstantTensors().size()); - Tensor constant0 = model.largeConstants().get("test_Variable"); + Tensor constant0 = model.largeConstantTensors().get("test_Variable"); assertNotNull(constant0); assertEquals(new TensorType.Builder(TensorType.Value.FLOAT).indexed("d2", 784).indexed("d1", 10).build(), constant0.type()); assertEquals(7840, constant0.size()); - Tensor constant1 = model.largeConstants().get("test_Variable_1"); + Tensor constant1 = model.largeConstantTensors().get("test_Variable_1"); assertNotNull(constant1); assertEquals(new TensorType.Builder(TensorType.Value.FLOAT).indexed("d1", 10).build(), constant1.type()); assertEquals(10, constant1.size()); diff --git a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/TestableModel.java b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/TestableModel.java index 2682ee40d76..f78150d9875 100644 --- a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/TestableModel.java +++ b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/onnx/TestableModel.java @@ -63,8 +63,8 @@ public class TestableModel { static Context contextFrom(ImportedModel result) { TestableModelContext context = new TestableModelContext(); - result.largeConstants().forEach((name, tensor) -> context.put("constant(" + name + ")", new TensorValue(tensor))); - result.smallConstants().forEach((name, tensor) -> context.put("constant(" + name + ")", new TensorValue(tensor))); + result.largeConstantTensors().forEach((name, tensor) -> context.put("constant(" + name + ")", new TensorValue(tensor))); + result.smallConstantTensors().forEach((name, tensor) -> context.put("constant(" + name + ")", new TensorValue(tensor))); return context; } diff --git a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java index 60e0df8ba90..d9c7e67c946 100644 --- a/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java +++ b/model-integration/src/test/java/ai/vespa/rankingexpression/importer/vespa/VespaImportTestCase.java @@ -38,12 +38,12 @@ public class VespaImportTestCase { assertEquals("tensor(name{},x[3])", model.inputs().get("input1").toString()); assertEquals("tensor(x[3])", model.inputs().get("input2").toString()); - assertEquals(2, model.smallConstants().size()); - assertEquals("tensor(x[3]):[0.5, 1.5, 2.5]", model.smallConstants().get("constant1").toString()); - assertEquals("tensor():{3.0}", model.smallConstants().get("constant2").toString()); + assertEquals(2, model.smallConstantTensors().size()); + assertEquals("tensor(x[3]):[0.5, 1.5, 2.5]", model.smallConstantTensors().get("constant1").toString()); + assertEquals("tensor():{3.0}", model.smallConstantTensors().get("constant2").toString()); - assertEquals(1, model.largeConstants().size()); - assertEquals("tensor(x[3]):[0.5, 1.5, 2.5]", model.largeConstants().get("constant1asLarge").toString()); + assertEquals(1, model.largeConstantTensors().size()); + assertEquals("tensor(x[3]):[0.5, 1.5, 2.5]", model.largeConstantTensors().get("constant1asLarge").toString()); assertEquals(2, model.expressions().size()); assertEquals("reduce(reduce(input1 * input2, sum, name) * constant1, max, x) * constant2", @@ -71,8 +71,8 @@ public class VespaImportTestCase { assertTrue(model.expressions().isEmpty()); assertTrue(model.functions().isEmpty()); assertTrue(model.inputs().isEmpty()); - assertTrue(model.largeConstants().isEmpty()); - assertTrue(model.smallConstants().isEmpty()); + assertTrue(model.largeConstantTensors().isEmpty()); + assertTrue(model.smallConstantTensors().isEmpty()); } @Test |