diff options
author | Arnstein Ressem <aressem@gmail.com> | 2022-05-18 13:45:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-18 13:45:07 +0200 |
commit | c080a3c9b1ebd39b947aeddd1e5a0bf5e46d474c (patch) | |
tree | aad434533f9514747e80f339d87b984088e2f1f7 /config-model/src/test | |
parent | a4dbfc43c7df534ee5b032204ef19a7b038d7e3e (diff) |
Revert "Bratseth/model syntax"
Diffstat (limited to 'config-model/src/test')
5 files changed, 10 insertions, 45 deletions
diff --git a/config-model/src/test/cfg/application/stateless_eval/example.model b/config-model/src/test/cfg/application/stateless_eval/example.model index af1c85be4f0..1d2db15c3ba 100644 --- a/config-model/src/test/cfg/application/stateless_eval/example.model +++ b/config-model/src/test/cfg/application/stateless_eval/example.model @@ -7,6 +7,7 @@ model example { constants { constant1: tensor(x[3]):{{x:0}:0.5, {x:1}:1.5, {x:2}:2.5} constant2: 3.0 + #constant1asLarge tensor(x[3]): file:constant1asLarge.json } constant constant1asLarge { diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/parser/SchemaParserTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/parser/SchemaParserTestCase.java index 2284acc705c..17d94639d87 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/parser/SchemaParserTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/parser/SchemaParserTestCase.java @@ -93,7 +93,6 @@ public class SchemaParserTestCase { assertNotEquals("", schema.name()); } - // TODO: Many (all)? of the files below are parsed from other tests and can be removed from here @Test public void parse_various_old_sdfiles() throws Exception { checkFileParses("src/test/cfg/search/data/travel/schemas/TTData.sd"); @@ -181,6 +180,7 @@ public class SchemaParserTestCase { checkFileParses("src/test/derived/namecollision/collision.sd"); checkFileParses("src/test/derived/namecollision/collisionstruct.sd"); checkFileParses("src/test/derived/nearestneighbor/test.sd"); + checkFileParses("src/test/derived/neuralnet/neuralnet.sd"); checkFileParses("src/test/derived/newrank/newrank.sd"); checkFileParses("src/test/derived/nuwa/newsindex.sd"); checkFileParses("src/test/derived/orderilscripts/orderilscripts.sd"); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java index 5bf2115c3f7..114486a5ddc 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java @@ -13,7 +13,7 @@ import static org.junit.Assert.fail; public class RankingExpressionWithTensorTestCase { @Test - public void requireThatSingleLineConstantMappedTensorCanBeParsed() throws ParseException { + public void requireThatSingleLineConstantTensorAndTypeCanBeParsed() throws ParseException { RankProfileSearchFixture f = new RankProfileSearchFixture( " rank-profile my_profile {\n" + " first-phase {\n" + @@ -30,40 +30,6 @@ public class RankingExpressionWithTensorTestCase { } @Test - public void requireThatSingleLineConstantIndexedTensorCanBeParsed() throws ParseException { - RankProfileSearchFixture f = new RankProfileSearchFixture( - " rank-profile my_profile {\n" + - " first-phase {\n" + - " expression: sum(my_tensor)\n" + - " }\n" + - " constants {\n" + - " my_tensor tensor(x[3]):{ {x:0}:1, {x:1}:2, {x:2}:3 }\n" + - " }\n" + - " }"); - f.compileRankProfile("my_profile"); - f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile"); - f.assertRankProperty("tensor(x[3]):[1.0, 2.0, 3.0]", "constant(my_tensor).value", "my_profile"); - f.assertRankProperty("tensor(x[3])", "constant(my_tensor).type", "my_profile"); - } - - @Test - public void requireThatSingleLineConstantIndexedTensorShortFormCanBeParsed() throws ParseException { - RankProfileSearchFixture f = new RankProfileSearchFixture( - " rank-profile my_profile {\n" + - " first-phase {\n" + - " expression: sum(my_tensor)\n" + - " }\n" + - " constants {\n" + - " my_tensor tensor(x[3]):[1, 2, 3]\n" + - " }\n" + - " }"); - f.compileRankProfile("my_profile"); - f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile"); - f.assertRankProperty("tensor(x[3]):[1.0, 2.0, 3.0]", "constant(my_tensor).value", "my_profile"); - f.assertRankProperty("tensor(x[3])", "constant(my_tensor).type", "my_profile"); - } - - @Test public void requireConstantTensorCanBeReferredViaConstantFeature() throws ParseException { RankProfileSearchFixture f = new RankProfileSearchFixture( " rank-profile my_profile {\n" + diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java index 9183ed316e2..3deeef7f2a2 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ml/ModelsEvaluatorTest.java @@ -21,7 +21,7 @@ public class ModelsEvaluatorTest { public void testModelsEvaluator() { // Assumption fails but test passes on Intel macs // Assumption fails and test fails on ARM64 - //assumeTrue(OnnxEvaluator.isRuntimeAvailable()); + assumeTrue(OnnxEvaluator.isRuntimeAvailable()); ModelsEvaluator modelsEvaluator = ModelsEvaluatorTester.create("src/test/cfg/application/stateless_eval"); assertEquals(3, modelsEvaluator.models().size()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java index b8a14bc763b..34afca703e9 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SchemaInfoTestCase.java @@ -25,8 +25,7 @@ public class SchemaInfoTestCase { " query(myDouble1) double: 0.5" + " query(myDouble2) tensor()" + " query(myMap) tensor(key{}): { label1:1.0,\n \"label2\": 2.0, 'label3': 3.0 }" + - " query(myVector1) tensor(x[3]):\n\n[1 ,2.0,3]" + - " query(myVector2) tensor(x[3]):{{x:0}:1,{x: 1}: 2 , { x:2}:3.0 }" + + " query(myVector) tensor(x[3]):\n\n[1 ,2.0,3]" + " query(myMatrix) tensor(x[2],y[3]):[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]" + " query(myMixed1) tensor(key{},x[2]): { key1:[-1.0, 1.1], key2: [1,2]}" + " query(myMixed2) tensor(k1{},k2{},x[2]): { {k1:l1,k2:l1}:[-1.0, 1.1], {k1:l1,k2:l2}: [1,2]}" + @@ -59,7 +58,7 @@ public class SchemaInfoTestCase { tester.assertRankProfile(schema, 5, "rankfeatures", false, true); var schemaInfoProfile = tester.assertRankProfile(schema, 6, "inputs", false, false); - assertEquals(10, schemaInfoProfile.input().size()); + assertEquals(9, schemaInfoProfile.input().size()); var rankProfilesProfile = rankProfilesConfig.rankprofile().get(6); assertEquals("inputs", rankProfilesProfile.name()); assertInput("query(foo)", "tensor<float>(x[10])", null, 0, schemaInfoProfile, rankProfilesProfile); @@ -67,11 +66,10 @@ public class SchemaInfoTestCase { assertInput("query(myDouble1)", "tensor()", "0.5", 2, schemaInfoProfile, rankProfilesProfile); assertInput("query(myDouble2)", "tensor()", null, 3, schemaInfoProfile, rankProfilesProfile); assertInput("query(myMap)", "tensor(key{})", "tensor(key{}):{{key:label1}:1.0, {key:label2}:2.0, {key:label3}:3.0}", 4, schemaInfoProfile, rankProfilesProfile); - assertInput("query(myVector1)", "tensor(x[3])", "tensor(x[3]):{{x:0}:1.0, {x:1}:2.0, {x:2}:3.0}", 5, schemaInfoProfile, rankProfilesProfile); - assertInput("query(myVector2)", "tensor(x[3])", "tensor(x[3]):{{x:0}:1.0, {x:1}:2.0, {x:2}:3.0}", 6, schemaInfoProfile, rankProfilesProfile); - assertInput("query(myMatrix)", "tensor(x[2],y[3])", "tensor(x[2],y[3]):{{x:0,y:0}:1.0, {x:0,y:1}:2.0, {x:0,y:2}:3.0, {x:1,y:0}:4.0, {x:1,y:1}:5.0, {x:1,y:2}:6.0}", 7, schemaInfoProfile, rankProfilesProfile); - assertInput("query(myMixed1)", "tensor(key{},x[2])", "tensor(key{},x[2]):{{key:key1,x:0}:-1.0, {key:key1,x:1}:1.1, {key:key2,x:0}:1.0, {key:key2,x:1}:2.0}", 8, schemaInfoProfile, rankProfilesProfile); - assertInput("query(myMixed2)", "tensor(k1{},k2{},x[2])", "tensor(k1{},k2{},x[2]):{{k1:l1,k2:l1,x:0}:-1.0, {k1:l1,k2:l1,x:1}:1.1, {k1:l1,k2:l2,x:0}:1.0, {k1:l1,k2:l2,x:1}:2.0}", 9, schemaInfoProfile, rankProfilesProfile); + assertInput("query(myVector)", "tensor(x[3])", "tensor(x[3]):{{x:0}:1.0, {x:1}:2.0, {x:2}:3.0}", 5, schemaInfoProfile, rankProfilesProfile); + assertInput("query(myMatrix)", "tensor(x[2],y[3])", "tensor(x[2],y[3]):{{x:0,y:0}:1.0, {x:0,y:1}:2.0, {x:0,y:2}:3.0, {x:1,y:0}:4.0, {x:1,y:1}:5.0, {x:1,y:2}:6.0}", 6, schemaInfoProfile, rankProfilesProfile); + assertInput("query(myMixed1)", "tensor(key{},x[2])", "tensor(key{},x[2]):{{key:key1,x:0}:-1.0, {key:key1,x:1}:1.1, {key:key2,x:0}:1.0, {key:key2,x:1}:2.0}", 7, schemaInfoProfile, rankProfilesProfile); + assertInput("query(myMixed2)", "tensor(k1{},k2{},x[2])", "tensor(k1{},k2{},x[2]):{{k1:l1,k2:l1,x:0}:-1.0, {k1:l1,k2:l1,x:1}:1.1, {k1:l1,k2:l2,x:0}:1.0, {k1:l1,k2:l2,x:1}:2.0}", 8, schemaInfoProfile, rankProfilesProfile); assertEquals(2, schema.summaryclass().size()); assertEquals("default", schema.summaryclass(0).name()); |