summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorLester Solbakken <lesters@oath.com>2020-04-29 10:31:43 +0200
committerLester Solbakken <lesters@oath.com>2020-04-29 10:31:43 +0200
commit0d0de85cc0b9f280f91a992a015b323f7c9666da (patch)
treee7e7191f5dd2214ec73cba087d14dae4fb42d90c /config-model
parente1d922c6979fa06695bfdcec6cafb8988d67ff77 (diff)
Add method to fetch constants as tensors
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
index c3d6f457ce8..33b1e9c654c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/ml/ConvertedModel.java
@@ -209,8 +209,8 @@ public class ConvertedModel {
ModelStore store) {
// Add constants
Set<String> constantsReplacedByFunctions = new HashSet<>();
- model.smallConstants().forEach((k, v) -> transformSmallConstant(store, profile, k, v));
- model.largeConstants().forEach((k, v) -> transformLargeConstant(store, profile, queryProfiles,
+ model.smallConstantValues().forEach((k, v) -> transformSmallConstant(store, profile, k, v));
+ model.largeConstantValues().forEach((k, v) -> transformLargeConstant(store, profile, queryProfiles,
constantsReplacedByFunctions, k, v));
// Add functions
@@ -283,8 +283,7 @@ public class ConvertedModel {
}
private static void transformSmallConstant(ModelStore store, RankProfile profile, String constantName,
- String constantValueString) {
- Tensor constantValue = Tensor.from(constantValueString);
+ Tensor constantValue) {
store.writeSmallConstant(constantName, constantValue);
profile.addConstant(constantName, asValue(constantValue));
}
@@ -294,8 +293,7 @@ public class ConvertedModel {
QueryProfileRegistry queryProfiles,
Set<String> constantsReplacedByFunctions,
String constantName,
- String constantValueString) {
- Tensor constantValue = Tensor.from(constantValueString);
+ Tensor constantValue) {
RankProfile.RankingExpressionFunction rankingExpressionFunctionOverridingConstant = profile.getFunctions().get(constantName);
if (rankingExpressionFunctionOverridingConstant != null) {
TensorType functionType = rankingExpressionFunctionOverridingConstant.function().getBody().type(profile.typeContext(queryProfiles));