summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-08-20 08:56:52 +0200
committerJon Bratseth <bratseth@oath.com>2018-08-20 08:56:52 +0200
commit03e88f27bc2278fb711a8c4a8a85763b23067348 (patch)
tree3a325a5dc2f44ce7186ec202ea6b0fdc03b306ee /config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
parente11152b73bb9f4a8020034a6bca63e82124f7b26 (diff)
Revert "Merge pull request #6619 from vespa-engine/revert-6611-revert-6596-revert-6584-bratseth/generate-rank-profiles-for-all-models-part-2"
This reverts commit 0437e8cc1d550fb8c6d24ffe4da813067c542f62, reversing changes made to 1715b8393827c159f8709033075066b29932f852.
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
index b2ef08dcc36..80629172fe3 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithOnnxTestCase.java
@@ -123,6 +123,7 @@ public class RankingExpressionWithOnnxTestCase {
" expression: onnx('mnist_softmax.onnx')" +
" }\n" +
" }");
+ search.compileRankProfile("my_profile");
search.assertFirstPhaseExpression(vespaExpression, "my_profile");
fail("Expecting exception");
}
@@ -164,7 +165,7 @@ public class RankingExpressionWithOnnxTestCase {
catch (IllegalArgumentException expected) {
assertEquals("Rank profile 'my_profile' is invalid: Could not use Onnx model from " +
"onnx('mnist_softmax.onnx','y'): " +
- "Model does not have the specified signature 'y'",
+ "No expressions named 'y' in model 'mnist_softmax.onnx'. Available expressions: mnist_softmax.onnx.default.add",
Exceptions.toMessageString(expected));
}
}
@@ -220,7 +221,8 @@ public class RankingExpressionWithOnnxTestCase {
String vespaExpressionWithoutConstant =
"join(reduce(join(rename(Placeholder, (d0, d1), (d0, d2)), mnist_softmax_onnx_Variable, f(a,b)(a * b)), sum, d2), constant(mnist_softmax_onnx_Variable_1), f(a,b)(a + b))";
- RankProfileSearchFixture search = fixtureWith(rankProfile, new StoringApplicationPackage(applicationDir));
+ RankProfileSearchFixture search = uncompiledFixtureWith(rankProfile, new StoringApplicationPackage(applicationDir));
+ search.compileRankProfile("my_profile");
search.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile");
assertNull("Constant overridden by macro is not added",
@@ -234,7 +236,8 @@ public class RankingExpressionWithOnnxTestCase {
IOUtils.copyDirectory(applicationDir.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile(),
storedApplicationDirectory.append(ApplicationPackage.MODELS_GENERATED_DIR).toFile());
StoringApplicationPackage storedApplication = new StoringApplicationPackage(storedApplicationDirectory);
- RankProfileSearchFixture searchFromStored = fixtureWith(rankProfile, storedApplication);
+ RankProfileSearchFixture searchFromStored = uncompiledFixtureWith(rankProfile, storedApplication);
+ searchFromStored.compileRankProfile("my_profile");
searchFromStored.assertFirstPhaseExpression(vespaExpressionWithoutConstant, "my_profile");
assertNull("Constant overridden by macro is not added",
searchFromStored.search().getRankingConstants().get("mnist_softmax_onnx_Variable"));
@@ -271,19 +274,19 @@ public class RankingExpressionWithOnnxTestCase {
private RankProfileSearchFixture fixtureWith(String placeholderExpression, String firstPhaseExpression) {
return fixtureWith(placeholderExpression, firstPhaseExpression, null, null, "Placeholder",
- new StoringApplicationPackage(applicationDir));
+ new StoringApplicationPackage(applicationDir));
}
private RankProfileSearchFixture fixtureWith(String placeholderExpression, String firstPhaseExpression,
String constant, String field) {
return fixtureWith(placeholderExpression, firstPhaseExpression, constant, field, "Placeholder",
- new StoringApplicationPackage(applicationDir));
+ new StoringApplicationPackage(applicationDir));
}
- private RankProfileSearchFixture fixtureWith(String rankProfile, StoringApplicationPackage application) {
+ private RankProfileSearchFixture uncompiledFixtureWith(String rankProfile, StoringApplicationPackage application) {
try {
return new RankProfileSearchFixture(application, application.getQueryProfiles(),
- rankProfile, null, null);
+ rankProfile, null, null);
}
catch (ParseException e) {
throw new IllegalArgumentException(e);
@@ -297,7 +300,7 @@ public class RankingExpressionWithOnnxTestCase {
String macroName,
StoringApplicationPackage application) {
try {
- return new RankProfileSearchFixture(
+ RankProfileSearchFixture fixture = new RankProfileSearchFixture(
application,
application.getQueryProfiles(),
" rank-profile my_profile {\n" +
@@ -310,6 +313,8 @@ public class RankingExpressionWithOnnxTestCase {
" }",
constant,
field);
+ fixture.compileRankProfile("my_profile");
+ return fixture;
}
catch (ParseException e) {
throw new IllegalArgumentException(e);