summaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-12-22 15:14:34 +0100
committerJon Bratseth <bratseth@yahoo-inc.com>2016-12-22 15:14:34 +0100
commitf23a86c355c0b9a66a611bb2ca96edeff50bfc7b (patch)
tree9f6338e9bae9feab0369d1868609ae98415b7892 /vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
parent063a290e2bc16502e7cf691d29f3105c07cb768c (diff)
Add tensor argmax and argmin
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java')
-rw-r--r--vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
index e973fe00238..feeba1a7a10 100644
--- a/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
+++ b/vespajlib/src/test/java/com/yahoo/tensor/TensorTestCase.java
@@ -3,6 +3,7 @@ package com.yahoo.tensor;
import com.google.common.collect.ImmutableList;
import com.yahoo.tensor.evaluation.MapEvaluationContext;
import com.yahoo.tensor.evaluation.VariableTensor;
+import com.yahoo.tensor.functions.Argmax;
import com.yahoo.tensor.functions.ConstantTensor;
import com.yahoo.tensor.functions.Join;
import com.yahoo.tensor.functions.Reduce;
@@ -82,6 +83,7 @@ public class TensorTestCase {
assertEquals(Tensor.from("{ {x:0,y:0,z:0}:1, {x:0,y:1,z:0}:0, {x:1,y:0,z:0}:0, {x:1,y:1,z:0}:0, {x:2,y:0,z:0}:0, {x:2,y:1,z:0}:0, "+
" {x:0,y:0,z:1}:0, {x:0,y:1,z:1}:0, {x:1,y:0,z:1}:0, {x:1,y:1,z:1}:1, {x:2,y:0,z:1}:0, {x:2,y:1,z:1}:00 }"),
Tensor.diag(new TensorType.Builder().indexed("x", 3).indexed("y", 2).indexed("z", 2).build()));
+ assertEquals(Tensor.from("{ {x:1}:0, {x:3}:1, {x:9}:0 }"), Tensor.from("{ {x:1}:1, {x:3}:5, {x:9}:3 }").argmax("x"));
}
/** Test the same computation made in various ways which are implemented with special-case optimizations */