diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-02-24 18:32:38 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-02-24 18:32:38 +0100 |
commit | 6cb1c29a8076f22415ef448bd114dfec9b37e00e (patch) | |
tree | 6c6377915ab00cb06eac66d46ae3470edfc6f10a /vespajlib/src/main/java/com/yahoo | |
parent | 180bc0034ae5ba6f2b5644a7c520486bbcc511bd (diff) |
Cleanup and more type inference
- Use a type context in TensorTransformer
- Correct Join.outputType
- Understand tensorFromLabels and tensorFromWeightedSet
- Don't wrap simple tensor arguments in constant()
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java b/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java index 50b0e706a43..54568401adb 100644 --- a/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java +++ b/vespajlib/src/main/java/com/yahoo/tensor/functions/Join.java @@ -48,28 +48,8 @@ public class Join extends PrimitiveTensorFunction { } /** Returns the type resulting from applying Join to the two given types */ - // TODO: Replace implementation by new TensorType.Builder(a.type(), b.type()).build(); public static TensorType outputType(TensorType a, TensorType b) { - TensorType.Builder typeBuilder = new TensorType.Builder(); - for (int i = 0; i < a.dimensions().size(); ++i) { - TensorType.Dimension aDim = a.dimensions().get(i); - for (int j = 0; j < b.dimensions().size(); ++j) { - TensorType.Dimension bDim = b.dimensions().get(j); - if (aDim.name().equals(bDim.name())) { // include - if (aDim.isIndexed() && bDim.isIndexed()) { - if (aDim.size().isPresent() || bDim.size().isPresent()) - typeBuilder.indexed(aDim.name(), Math.min(aDim.size().orElse(Long.MAX_VALUE), - bDim.size().orElse(Long.MAX_VALUE))); - else - typeBuilder.indexed(aDim.name()); - } - else { - typeBuilder.mapped(aDim.name()); - } - } - } - } - return typeBuilder.build(); + return new TensorType.Builder(a, b).build(); } public DoubleBinaryOperator combinator() { return combinator; } |