From 9faebe628164657eaad3de625b9b799a385aea6e Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Mon, 26 Jun 2023 09:51:35 +0000 Subject: add class comment and test expansion --- .../com/yahoo/tensor/functions/EuclideanDistanceTestCase.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'vespajlib/src/test') diff --git a/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java b/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java index 9d06c313ecc..4fae432b3ca 100644 --- a/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java +++ b/vespajlib/src/test/java/com/yahoo/tensor/functions/EuclideanDistanceTestCase.java @@ -3,6 +3,7 @@ package com.yahoo.tensor.functions; import com.yahoo.tensor.Tensor; import com.yahoo.tensor.TensorType; +import com.yahoo.tensor.evaluation.VariableTensor; import org.junit.Test; import java.util.List; @@ -40,4 +41,14 @@ public class EuclideanDistanceTestCase { assertEquals(expect, result); } + @Test + public void testExpansion() { + var tType = TensorType.fromSpec("tensor(vecdim[128])"); + var a = new VariableTensor<>("left", tType); + var b = new VariableTensor<>("right", tType); + var op = new EuclideanDistance<>(a, b, "vecdim"); + assertEquals("map(reduce(map(join(left, right, f(a,b)(a - b)), f(a)(a * a)), sum, vecdim), f(a)(sqrt(a)))", + op.toPrimitive().toString()); + } + } -- cgit v1.2.3