diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-03-08 16:22:01 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-03-08 16:22:01 +0100 |
commit | 8f21c54b669202cdcc1a04934762dceebb929308 (patch) | |
tree | cddb1bf2cb106b5eb92594785f7daef69f41e3b4 /searchlib/src/test/java/com/yahoo | |
parent | f19b783d4014f799482daa13f8f8c26d5c4c84d9 (diff) |
Add TensorFlow variable converter
Diffstat (limited to 'searchlib/src/test/java/com/yahoo')
-rw-r--r-- | searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/integration/tensorflow/VariableConverterTestCase.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/integration/tensorflow/VariableConverterTestCase.java b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/integration/tensorflow/VariableConverterTestCase.java new file mode 100644 index 00000000000..051c2c60c95 --- /dev/null +++ b/searchlib/src/test/java/com/yahoo/searchlib/rankingexpression/integration/tensorflow/VariableConverterTestCase.java @@ -0,0 +1,20 @@ +package com.yahoo.searchlib.rankingexpression.integration.tensorflow; + +import org.junit.Test; + +import java.nio.charset.StandardCharsets; + +import static org.junit.Assert.assertEquals; + +public class VariableConverterTestCase { + + @Test + public void testConversion() { + byte[] converted = VariableConverter.importVariable("src/test/files/integration/tensorflow/mnist_softmax/saved", + "Variable_1", + "tensor(d0[10],d1[1])"); + assertEquals("{\"cells\":[{\"address\":{\"d0\":\"0\",\"d1\":\"0\"},\"value\":-0.3546536862850189},{\"address\":{\"d0\":\"1\",\"d1\":\"0\"},\"value\":0.3759574592113495},{\"address\":{\"d0\":\"2\",\"d1\":\"0\"},\"value\":0.06054411828517914},{\"address\":{\"d0\":\"3\",\"d1\":\"0\"},\"value\":-0.251544713973999},{\"address\":{\"d0\":\"4\",\"d1\":\"0\"},\"value\":0.01795101352035999},{\"address\":{\"d0\":\"5\",\"d1\":\"0\"},\"value\":1.289906740188599},{\"address\":{\"d0\":\"6\",\"d1\":\"0\"},\"value\":-0.1038961559534073},{\"address\":{\"d0\":\"7\",\"d1\":\"0\"},\"value\":0.6367976665496826},{\"address\":{\"d0\":\"8\",\"d1\":\"0\"},\"value\":-1.413674473762512},{\"address\":{\"d0\":\"9\",\"d1\":\"0\"},\"value\":-0.2573896050453186}]}", + new String(converted, StandardCharsets.UTF_8)); + } + +} |