summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-11-28 08:54:41 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2016-11-28 08:54:41 +0100
commitb9161cb0f3eec983af285e01fae9b28756f038a0 (patch)
tree082316e679ccd2a81d8fff12fffe67c798811a2a /config-model
parent2f55986b4de9420e5728c5abbaafb69fb2f10a34 (diff)
Propagate set/getChildren
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java7
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorTestCase.java37
2 files changed, 10 insertions, 34 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
index cade223d51a..4ece81860e2 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionShadowingTestCase.java
@@ -4,6 +4,7 @@ import com.yahoo.collections.Pair;
import com.yahoo.searchdefinition.derived.AttributeFields;
import com.yahoo.searchdefinition.derived.RawRankProfile;
import com.yahoo.searchdefinition.parser.ParseException;
+import org.junit.Ignore;
import org.junit.Test;
import java.util.ArrayList;
@@ -165,11 +166,11 @@ public class RankingExpressionShadowingTestCase extends SearchDefinitionTestCase
for (Object o : testRankProperties)
System.out.println(o);
assertEquals("(rankingExpression(relu).rankingScript,max(1.0,x))", testRankProperties.get(0).toString());
- assertEquals("(rankingExpression(relu@).rankingScript,max(1.0,sum(query(q) * constant(W_hidden), input) + constant(b_input)))", censorBindingHash(testRankProperties.get(1).toString()));
+ assertEquals("(rankingExpression(relu@).rankingScript,max(1.0,reduce(query(q) * constant(W_hidden), sum, input) + constant(b_input)))", censorBindingHash(testRankProperties.get(1).toString()));
assertEquals("(rankingExpression(hidden_layer).rankingScript,rankingExpression(relu@))", censorBindingHash(testRankProperties.get(2).toString()));
- assertEquals("(rankingExpression(final_layer).rankingScript,sigmoid(sum(rankingExpression(hidden_layer) * constant(W_final), hidden) + constant(b_final)))", testRankProperties.get(3).toString());
+ assertEquals("(rankingExpression(final_layer).rankingScript,sigmoid(reduce(rankingExpression(hidden_layer) * constant(W_final), sum, hidden) + constant(b_final)))", testRankProperties.get(3).toString());
assertEquals("(vespa.rank.secondphase,rankingExpression(secondphase))", testRankProperties.get(4).toString());
- assertEquals("(rankingExpression(secondphase).rankingScript,sum(rankingExpression(final_layer)))", testRankProperties.get(5).toString());
+ assertEquals("(rankingExpression(secondphase).rankingScript,reduce(rankingExpression(final_layer), sum))", testRankProperties.get(5).toString());
}
private String censorBindingHash(String s) {
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 19547c5039b..f6a7ddd4983 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
@@ -54,31 +54,6 @@ public class RankingExpressionWithTensorTestCase {
}
@Test
- public void requireThatExpressionWithSingleLineTensorCanBeParsed() throws ParseException {
- SearchFixture f = new SearchFixture(
- " rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression: sum({ {x:1}:1, {x:2,y:1}:2 })\n" +
- " }\n" +
- " }");
- f.assertFirstPhaseExpression("sum({{x:1}:1.0,{x:2,y:1}:2.0})", "my_profile");
- }
-
- @Test
- public void requireThatExpressionWithMultiLineTensorCanBeParsed() throws ParseException {
- SearchFixture f = new SearchFixture(
- " rank-profile my_profile {\n" +
- " first-phase {\n" +
- " expression {\n" +
- " sum({ {x:1}:1,\n" +
- " {x:2,y:1}:2 })\n" +
- " }\n" +
- " }\n" +
- " }");
- f.assertFirstPhaseExpression("sum({{x:1}:1.0,{x:2,y:1}:2.0})", "my_profile");
- }
-
- @Test
public void requireThatSingleLineConstantTensorAndTypeCanBeParsed() throws ParseException {
SearchFixture f = new SearchFixture(
" rank-profile my_profile {\n" +
@@ -92,7 +67,7 @@ public class RankingExpressionWithTensorTestCase {
" }\n" +
" }\n" +
" }");
- f.assertFirstPhaseExpression("sum(constant(my_tensor))", "my_profile");
+ f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("{{x:1}:1.0,{x:2,y:1}:2.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor(x{},y{})", "constant(my_tensor).type", "my_profile");
}
@@ -114,7 +89,7 @@ public class RankingExpressionWithTensorTestCase {
" }\n" +
" }\n" +
" }");
- f.assertFirstPhaseExpression("sum(constant(my_tensor))", "my_profile");
+ f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("{{x:1}:1.0,{x:2,y:1}:2.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor(x{},y{})", "constant(my_tensor).type", "my_profile");
}
@@ -132,7 +107,7 @@ public class RankingExpressionWithTensorTestCase {
" }\n" +
" }\n" +
" }");
- f.assertSecondPhaseExpression("sum(constant(my_tensor))", "my_profile");
+ f.assertSecondPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("{{x:1}:1.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor", "constant(my_tensor).type", "my_profile");
}
@@ -152,7 +127,7 @@ public class RankingExpressionWithTensorTestCase {
" expression: sum(my_tensor)\n" +
" }\n" +
" }");
- f.assertFirstPhaseExpression("sum(constant(my_tensor))", "my_profile");
+ f.assertFirstPhaseExpression("reduce(constant(my_tensor), sum)", "my_profile");
f.assertRankProperty("{{x:1}:1.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor", "constant(my_tensor).type", "my_profile");
}
@@ -174,7 +149,7 @@ public class RankingExpressionWithTensorTestCase {
" }\n" +
" }");
f.assertFirstPhaseExpression("5.0 + my_macro", "my_profile");
- f.assertMacro("sum(constant(my_tensor))", "my_macro", "my_profile");
+ f.assertMacro("reduce(constant(my_tensor), sum)", "my_macro", "my_profile");
f.assertRankProperty("{{x:1}:1.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor", "constant(my_tensor).type", "my_profile");
}
@@ -194,7 +169,7 @@ public class RankingExpressionWithTensorTestCase {
" my_number_2: 5.0\n" +
" }\n" +
" }");
- f.assertFirstPhaseExpression("3.0 + sum(constant(my_tensor)) + 5.0", "my_profile");
+ f.assertFirstPhaseExpression("3.0 + reduce(constant(my_tensor), sum) + 5.0", "my_profile");
f.assertRankProperty("{{x:1}:1.0}", "constant(my_tensor).value", "my_profile");
f.assertRankProperty("tensor", "constant(my_tensor).type", "my_profile");
}