diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-11-27 15:58:06 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-11-27 15:58:06 +0200 |
commit | 77bb8f5117b7a0f78b2dc99a3937430339e4291d (patch) | |
tree | 9037b54f17e3175a8d11e1b43b55b71887f867a4 /vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java | |
parent | f4203c3cc571722f08ee65047437c1290ed63f69 (diff) |
Support index generating expressions in tensor value functions
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java')
-rw-r--r-- | vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java b/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java index 439aac5578a..9c4fa0cf931 100644 --- a/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java +++ b/vespajlib/src/test/java/com/yahoo/tensor/MatrixDotProductBenchmark.java @@ -2,6 +2,7 @@ package com.yahoo.tensor; import com.yahoo.tensor.evaluation.MapEvaluationContext; +import com.yahoo.tensor.evaluation.TypeContext; import com.yahoo.tensor.evaluation.VariableTensor; import com.yahoo.tensor.functions.ConstantTensor; import com.yahoo.tensor.functions.Join; @@ -42,10 +43,10 @@ public class MatrixDotProductBenchmark { private double dotProduct(Tensor tensor, List<Tensor> tensors) { double largest = Double.MIN_VALUE; - TensorFunction dotProductFunction = new Reduce(new Join(new ConstantTensor(tensor), - new VariableTensor("argument"), (a, b) -> a * b), - Reduce.Aggregator.sum).toPrimitive(); - MapEvaluationContext context = new MapEvaluationContext(); + TensorFunction<TypeContext.Name> dotProductFunction = new Reduce<>(new Join<>(new ConstantTensor<>(tensor), + new VariableTensor<>("argument"), (a, b) -> a * b), + Reduce.Aggregator.sum).toPrimitive(); + MapEvaluationContext<TypeContext.Name> context = new MapEvaluationContext<>(); for (Tensor tensorElement : tensors) { // tensors.size() = 1 for larger tensor context.put("argument", tensorElement); |