diff options
author | Lester Solbakken <lesters@oath.com> | 2020-09-02 16:23:19 +0200 |
---|---|---|
committer | Lester Solbakken <lesters@oath.com> | 2020-09-02 16:23:19 +0200 |
commit | 2d66843825d1fcb698744b5c5191664ca21f2781 (patch) | |
tree | 0fd3dbe68ae2feae3e45d527f3c0962e6615df4f | |
parent | c80e560d472bb37643b0eadac9e4915b16d11f3d (diff) |
Add test files for onnxModel unit test
4 files changed, 56 insertions, 5 deletions
diff --git a/config-model/src/test/integration/onnx-file/files/simple.onnx b/config-model/src/test/integration/onnx-file/files/simple.onnx new file mode 100644 index 00000000000..eaa66f533da --- /dev/null +++ b/config-model/src/test/integration/onnx-file/files/simple.onnx @@ -0,0 +1,23 @@ + simple.py:ß +0 +query_tensor +attribute_tensormatmul"MatMul +" +matmul +bias_tensoroutput"Addsimple_scoringZ +query_tensor + + +Z" +attribute_tensor + + +Z +bias_tensor + + +b +output + + +B
\ No newline at end of file diff --git a/config-model/src/test/integration/onnx-file/searchdefinitions/test.sd b/config-model/src/test/integration/onnx-file/searchdefinitions/test.sd new file mode 100644 index 00000000000..5ca0cd1b8bf --- /dev/null +++ b/config-model/src/test/integration/onnx-file/searchdefinitions/test.sd @@ -0,0 +1,11 @@ +# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +search test { + document test {} + + rank-profile my_profile inherits default { + first-phase { + expression: onnxModel("files/simple.onnx", "output") + } + } + +} diff --git a/config-model/src/test/integration/onnx-file/services.xml b/config-model/src/test/integration/onnx-file/services.xml new file mode 100644 index 00000000000..892ce9a9f89 --- /dev/null +++ b/config-model/src/test/integration/onnx-file/services.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8" ?> +<!-- Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<services> + <admin version="2.0"> + <adminserver hostalias="node1" /> + <logserver hostalias="node1" /> + </admin> + <content id="test" version="1.0"> + <redundancy>1</redundancy> + <documents> + <document type='test' mode="index"/> + </documents> + <nodes> + <node hostalias='node1' distribution-key='0'/> + </nodes> + </content> +</services> diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java index 1ec82bb8c41..7e129410b37 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxModelTestCase.java @@ -15,16 +15,16 @@ import static org.junit.Assert.assertEquals; public class RankingExpressionWithOnnxModelTestCase { @Test - public void testOnnxModelFeature() throws Exception { + public void testOnnxModelFeature() { VespaModel model = new VespaModelCreatorWithFilePkg("src/test/integration/onnx-file").create(); DocumentDatabase db = ((IndexedSearchCluster)model.getSearchClusters().get(0)).getDocumentDbs().get(0); - String modelName = OnnxModelTransformer.toModelName("other/mnist_softmax.onnx"); + String modelName = OnnxModelTransformer.toModelName("files/simple.onnx"); // Ranking expression should be transformed from - // onnxModel("other/mnist_softmax.onnx", "add") + // onnxModel("files/simple.onnx", "output") // to - // onnxModel(other_mnist_softmax_onnx).add + // onnxModel(files_simple_onnx).output assertTransformedFeature(db, modelName); assertGeneratedConfig(db, modelName); @@ -45,7 +45,7 @@ public class RankingExpressionWithOnnxModelTestCase { assertEquals(3, config.rankprofile().size()); assertEquals("my_profile", config.rankprofile(2).name()); assertEquals("vespa.rank.firstphase", config.rankprofile(2).fef().property(0).name()); - assertEquals("onnxModel(" + modelName + ").add", config.rankprofile(2).fef().property(0).value()); + assertEquals("onnxModel(" + modelName + ").output", config.rankprofile(2).fef().property(0).value()); } } |