diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-01-31 12:31:58 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-01-31 12:31:58 +0100 |
commit | e94d28dd48c5ac5f40885d7d64cd8480bebba3c8 (patch) | |
tree | 1e4f17f16ed69432f7c11058d19b38ce3581951c /config-model/src | |
parent | a44edeba9f38c38c431d7b9b6e1ac454e2a0e610 (diff) |
Nonfunctional changes only
Diffstat (limited to 'config-model/src')
3 files changed, 42 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java index 3b68e0199a9..cd65c6ef761 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java @@ -708,7 +708,8 @@ public class RankProfile implements Serializable, Cloneable { private void checkNameCollisions(Map<String, Macro> macros, Map<String, Value> constants) { for (Map.Entry<String, Macro> macroEntry : macros.entrySet()) { if (constants.get(macroEntry.getKey()) != null) - throw new IllegalArgumentException("Cannot have both a constant and macro named '" + macroEntry.getKey() + "'"); + throw new IllegalArgumentException("Cannot have both a constant and macro named '" + + macroEntry.getKey() + "'"); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/TensorFlowFeatureConverter.java b/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/TensorFlowFeatureConverter.java index d0f705d4c9a..9c7fd7d9f0a 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/TensorFlowFeatureConverter.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/expressiontransforms/TensorFlowFeatureConverter.java @@ -189,7 +189,7 @@ public class TensorFlowFeatureConverter extends ExpressionTransformer<RankProfil throw new IllegalArgumentException("Model refers Placeholder '" + macroName + "' of type " + requiredType + " which must be produced by a macro in the rank profile, but " + - "this macro produces type " + actualType + " in " + profile); + "this macro produces type " + actualType); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java index c24e886c83d..82d0d66a82a 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/RankingExpressionWithTensorFlowTestCase.java @@ -80,6 +80,45 @@ public class RankingExpressionWithTensorFlowTestCase { } @Test + public void testTensorFlowReferenceMissingMacro() throws ParseException { + try { + RankProfileSearchFixture search = new RankProfileSearchFixture( + new StoringApplicationPackage(applicationDir), + " rank-profile my_profile {\n" + + " first-phase {\n" + + " expression: tensorflow('mnist_softmax/saved')" + + " }\n" + + " }"); + search.assertFirstPhaseExpression(vespaExpression, "my_profile"); + fail("Expecting exception"); + } + catch (IllegalArgumentException expected) { + assertEquals("Rank profile 'my_profile' is invalid: Could not use tensorflow model from " + + "tensorflow('mnist_softmax/saved'): " + + "Model refers Placeholder 'Placeholder' of type tensor(d0[],d1[784]) but this macro is " + + "not present in rank profile 'my_profile'", + Exceptions.toMessageString(expected)); + } + } + + @Test + public void testTensorFlowReferenceWithWrongMacroType() throws ParseException { + try { + RankProfileSearchFixture search = fixtureWith("tensor(d0[2],d5[10])(0.0)", + "tensorflow('mnist_softmax/saved')"); + search.assertFirstPhaseExpression(vespaExpression, "my_profile"); + fail("Expecting exception"); + } + catch (IllegalArgumentException expected) { + assertEquals("Rank profile 'my_profile' is invalid: Could not use tensorflow model from " + + "tensorflow('mnist_softmax/saved'): " + + "Model refers Placeholder 'Placeholder' of type tensor(d0[],d1[784]) which must be produced " + + "by a macro in the rank profile, but this macro produces type tensor(d0[2],d5[10])", + Exceptions.toMessageString(expected)); + } + } + + @Test public void testTensorFlowReferenceSpecifyingNonExistingSignature() throws ParseException { try { RankProfileSearchFixture search = fixtureWith("tensor(d0[2],d1[784])(0.0)", |