aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/application
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-07-06 11:18:32 +0000
committerArne Juul <arnej@yahooinc.com>2023-07-06 11:18:32 +0000
commit4e5814778ac43143d42e6ce0336df8976a0ba48b (patch)
treeee5cb5fd9fd2176eebc9f0c4689960a4e99c5a6e /config-model/src/main/java/com/yahoo/vespa/model/application
parent56ffeb1c1a75374e38304d73ce8004fd3626fc27 (diff)
disallow scalars
* backend expects actual tensor objects, not just a number * garbage collect some unused code
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/application')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java26
1 files changed, 2 insertions, 24 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
index df3cd4103d9..92c9eccf2d3 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/ConstantTensorJsonValidator.java
@@ -112,9 +112,8 @@ public class ConstantTensorJsonValidator {
consumeTopObject();
return;
} else if (isScalar()) {
- if (top == JsonToken.VALUE_NUMBER_FLOAT || top == JsonToken.VALUE_NUMBER_INT) {
- return;
- }
+ throw new InvalidConstantTensorException(
+ parser, String.format("Invalid type %s: Only tensors with dimensions can be stored as file constants", tensorType.toString()));
}
throw new InvalidConstantTensorException(
parser, String.format("Unexpected first token '%s' for constant with type %s",
@@ -315,14 +314,6 @@ public class ConstantTensorJsonValidator {
}
}
- private void assertFieldNameIs(String wantedFieldName) throws IOException {
- String actualFieldName = parser.getCurrentName();
-
- if (!actualFieldName.equals(wantedFieldName)) {
- throw new InvalidConstantTensorException(parser, String.format("Expected field name '%s', got '%s'", wantedFieldName, actualFieldName));
- }
- }
-
static class InvalidConstantTensorException extends IllegalArgumentException {
InvalidConstantTensorException(JsonParser parser, String message) {
@@ -338,19 +329,6 @@ public class ConstantTensorJsonValidator {
}
}
- @FunctionalInterface
- private interface SubroutineThrowingIOException {
- void invoke() throws IOException;
- }
-
- private void wrapIOException(SubroutineThrowingIOException lambda) {
- try {
- lambda.invoke();
- } catch (IOException e) {
- throw new InvalidConstantTensorException(parser, e);
- }
- }
-
private void consumeValuesNesting(int level) throws IOException {
assertCurrentTokenIs(JsonToken.START_ARRAY);
if (level >= denseDims.size()) {