summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2020-12-09 20:21:04 +0100
committerGitHub <noreply@github.com>2020-12-09 20:21:04 +0100
commit80db966fd7477f1267613f469ff70787af95b54e (patch)
treebdb878f82fecdbd8c004204c3ca60fbd57ba2af5
parentf3e2acd0df995ea17ddf016719d0f2ef33ef1427 (diff)
parentb66792587ac1c7164700db323dd7f2483062bbbd (diff)
Merge pull request #15764 from vespa-engine/arnej/move-dense-optimizers
Arnej/move dense optimizers
-rw-r--r--eval/CMakeLists.txt24
-rw-r--r--eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp6
-rw-r--r--eval/src/tests/eval/typed_cells/CMakeLists.txt (renamed from eval/src/tests/tensor/typed_cells/CMakeLists.txt)0
-rw-r--r--eval/src/tests/eval/typed_cells/typed_cells_test.cpp (renamed from eval/src/tests/tensor/typed_cells/typed_cells_test.cpp)0
-rw-r--r--eval/src/tests/instruction/dense_add_dimension_optimizer/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_add_dimension_optimizer/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp (renamed from eval/src/tests/tensor/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp)5
-rw-r--r--eval/src/tests/instruction/dense_fast_rename_optimizer/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_fast_rename_optimizer/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp (renamed from eval/src/tests/tensor/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp)5
-rw-r--r--eval/src/tests/instruction/dense_inplace_join_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_inplace_join_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp (renamed from eval/src/tests/tensor/dense_inplace_join_function/dense_inplace_join_function_test.cpp)1
-rw-r--r--eval/src/tests/instruction/dense_pow_as_map_optimizer/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_pow_as_map_optimizer/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp (renamed from eval/src/tests/tensor/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp)3
-rw-r--r--eval/src/tests/instruction/dense_remove_dimension_optimizer/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_remove_dimension_optimizer/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp (renamed from eval/src/tests/tensor/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp)5
-rw-r--r--eval/src/tests/instruction/dense_replace_type_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_replace_type_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_replace_type_function/dense_replace_type_function_test.cpp (renamed from eval/src/tests/tensor/dense_replace_type_function/dense_replace_type_function_test.cpp)5
-rw-r--r--eval/src/tests/instruction/dense_simple_join_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_simple_join_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_simple_join_function/dense_simple_join_function_test.cpp (renamed from eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp)5
-rw-r--r--eval/src/tests/instruction/dense_simple_map_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_simple_map_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_simple_map_function/dense_simple_map_function_test.cpp (renamed from eval/src/tests/tensor/dense_simple_map_function/dense_simple_map_function_test.cpp)3
-rw-r--r--eval/src/tests/instruction/dense_single_reduce_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_single_reduce_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp (renamed from eval/src/tests/tensor/dense_single_reduce_function/dense_single_reduce_function_test.cpp)3
-rw-r--r--eval/src/tests/instruction/dense_tensor_create_function/CMakeLists.txt (renamed from eval/src/tests/tensor/dense_tensor_create_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp (renamed from eval/src/tests/tensor/dense_tensor_create_function/dense_tensor_create_function_test.cpp)3
-rw-r--r--eval/src/tests/instruction/vector_from_doubles_function/CMakeLists.txt (renamed from eval/src/tests/tensor/vector_from_doubles_function/CMakeLists.txt)0
-rw-r--r--eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp (renamed from eval/src/tests/tensor/vector_from_doubles_function/vector_from_doubles_function_test.cpp)3
-rw-r--r--eval/src/tests/tensor/dense_dimension_combiner/CMakeLists.txt9
-rw-r--r--eval/src/tests/tensor/dense_dimension_combiner/dense_dimension_combiner_test.cpp185
-rw-r--r--eval/src/tests/tensor/direct_sparse_tensor_builder/CMakeLists.txt8
-rw-r--r--eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp119
-rw-r--r--eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp1
-rw-r--r--eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp1
-rw-r--r--eval/src/tests/tensor/tensor_address/tensor_address_test.cpp2
-rw-r--r--eval/src/vespa/eval/eval/optimize_tensor_function.cpp20
-rw-r--r--eval/src/vespa/eval/eval/tensor_function.h3
-rw-r--r--eval/src/vespa/eval/eval/value_type.cpp2
-rw-r--r--eval/src/vespa/eval/instruction/CMakeLists.txt10
-rw-r--r--eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.cpp)15
-rw-r--r--eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h (renamed from eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.h)7
-rw-r--r--eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.cpp)14
-rw-r--r--eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h (renamed from eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.h)7
-rw-r--r--eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp4
-rw-r--r--eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.cpp)11
-rw-r--r--eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h (renamed from eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.h)7
-rw-r--r--eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.cpp)16
-rw-r--r--eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h (renamed from eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.h)7
-rw-r--r--eval/src/vespa/eval/instruction/dense_replace_type_function.cpp48
-rw-r--r--eval/src/vespa/eval/instruction/dense_replace_type_function.h (renamed from eval/src/vespa/eval/tensor/dense/dense_replace_type_function.h)17
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_join_function.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_simple_join_function.cpp)27
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_join_function.h (renamed from eval/src/vespa/eval/tensor/dense/dense_simple_join_function.h)18
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_map_function.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_simple_map_function.cpp)24
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_map_function.h26
-rw-r--r--eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.cpp)27
-rw-r--r--eval/src/vespa/eval/instruction/dense_single_reduce_function.h (renamed from eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.h)24
-rw-r--r--eval/src/vespa/eval/instruction/dense_tensor_create_function.cpp (renamed from eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.cpp)28
-rw-r--r--eval/src/vespa/eval/instruction/dense_tensor_create_function.h34
-rw-r--r--eval/src/vespa/eval/instruction/generic_join.h2
-rw-r--r--eval/src/vespa/eval/instruction/generic_lambda.cpp6
-rw-r--r--eval/src/vespa/eval/instruction/generic_lambda.h2
-rw-r--r--eval/src/vespa/eval/instruction/generic_map.h2
-rw-r--r--eval/src/vespa/eval/instruction/join_with_number_function.h4
-rw-r--r--eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp (renamed from eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.cpp)31
-rw-r--r--eval/src/vespa/eval/instruction/vector_from_doubles_function.h (renamed from eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.h)22
-rw-r--r--eval/src/vespa/eval/onnx/onnx_wrapper.cpp36
-rw-r--r--eval/src/vespa/eval/onnx/onnx_wrapper.h24
-rw-r--r--eval/src/vespa/eval/tensor/dense/CMakeLists.txt10
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_replace_type_function.cpp54
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_simple_map_function.h25
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor.cpp76
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.h33
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp46
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h41
-rw-r--r--searchlib/src/vespa/searchlib/features/onnx_feature.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/features/onnx_feature.h2
74 files changed, 325 insertions, 885 deletions
diff --git a/eval/CMakeLists.txt b/eval/CMakeLists.txt
index 36796faa2fe..c2dd847e715 100644
--- a/eval/CMakeLists.txt
+++ b/eval/CMakeLists.txt
@@ -36,6 +36,7 @@ vespa_define_module(
src/tests/eval/value_cache
src/tests/eval/value_codec
src/tests/eval/value_type
+ src/tests/eval/typed_cells
src/tests/gp/ponder_nov2017
src/tests/instruction/dense_xw_product_function
src/tests/instruction/generic_concat
@@ -53,22 +54,21 @@ vespa_define_module(
src/tests/instruction/dense_tensor_peek_function
src/tests/instruction/index_lookup_table
src/tests/instruction/join_with_number
+ src/tests/instruction/dense_add_dimension_optimizer
+ src/tests/instruction/dense_fast_rename_optimizer
+ src/tests/instruction/dense_inplace_join_function
+ src/tests/instruction/dense_pow_as_map_optimizer
+ src/tests/instruction/dense_remove_dimension_optimizer
+ src/tests/instruction/dense_replace_type_function
+ src/tests/instruction/dense_simple_join_function
+ src/tests/instruction/dense_simple_map_function
+ src/tests/instruction/dense_single_reduce_function
+ src/tests/instruction/dense_tensor_create_function
+ src/tests/instruction/vector_from_doubles_function
src/tests/streamed/value
- src/tests/tensor/dense_add_dimension_optimizer
- src/tests/tensor/dense_fast_rename_optimizer
- src/tests/tensor/dense_inplace_join_function
- src/tests/tensor/dense_pow_as_map_optimizer
- src/tests/tensor/dense_remove_dimension_optimizer
- src/tests/tensor/dense_replace_type_function
- src/tests/tensor/dense_simple_join_function
- src/tests/tensor/dense_simple_map_function
- src/tests/tensor/dense_single_reduce_function
- src/tests/tensor/dense_tensor_create_function
src/tests/tensor/instruction_benchmark
src/tests/tensor/onnx_wrapper
src/tests/tensor/tensor_conformance
- src/tests/tensor/typed_cells
- src/tests/tensor/vector_from_doubles_function
LIBS
src/vespa/eval
diff --git a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
index 73a3648a34c..7094686e399 100644
--- a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
+++ b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
@@ -4,10 +4,10 @@
#include <vespa/eval/eval/tensor_function.h>
#include <vespa/eval/eval/simple_value.h>
#include <vespa/eval/eval/fast_value.h>
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
#include <vespa/eval/instruction/dense_cell_range_function.h>
#include <vespa/eval/instruction/dense_lambda_peek_function.h>
-#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
+#include <vespa/eval/instruction/dense_fast_rename_optimizer.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
#include <vespa/eval/eval/tensor_nodes.h>
@@ -62,7 +62,7 @@ void verify_generic(const vespalib::string &expr, const vespalib::string &expect
}
void verify_reshape(const vespalib::string &expr, const vespalib::string &expect) {
- verify_impl<tensor::DenseReplaceTypeFunction>(expr, expect);
+ verify_impl<DenseReplaceTypeFunction>(expr, expect);
}
void verify_range(const vespalib::string &expr, const vespalib::string &expect) {
diff --git a/eval/src/tests/tensor/typed_cells/CMakeLists.txt b/eval/src/tests/eval/typed_cells/CMakeLists.txt
index d57ff33eda6..d57ff33eda6 100644
--- a/eval/src/tests/tensor/typed_cells/CMakeLists.txt
+++ b/eval/src/tests/eval/typed_cells/CMakeLists.txt
diff --git a/eval/src/tests/tensor/typed_cells/typed_cells_test.cpp b/eval/src/tests/eval/typed_cells/typed_cells_test.cpp
index ccb522fd496..ccb522fd496 100644
--- a/eval/src/tests/tensor/typed_cells/typed_cells_test.cpp
+++ b/eval/src/tests/eval/typed_cells/typed_cells_test.cpp
diff --git a/eval/src/tests/tensor/dense_add_dimension_optimizer/CMakeLists.txt b/eval/src/tests/instruction/dense_add_dimension_optimizer/CMakeLists.txt
index 1bc9f93b1a2..1bc9f93b1a2 100644
--- a/eval/src/tests/tensor/dense_add_dimension_optimizer/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_add_dimension_optimizer/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp b/eval/src/tests/instruction/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp
index 0e8e50daae5..e7660ce8933 100644
--- a/eval/src/tests/tensor/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp
+++ b/eval/src/tests/instruction/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp
@@ -3,8 +3,8 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
-#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_fast_rename_optimizer.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -14,7 +14,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_fast_rename_optimizer/CMakeLists.txt b/eval/src/tests/instruction/dense_fast_rename_optimizer/CMakeLists.txt
index 32cf6c45d1e..32cf6c45d1e 100644
--- a/eval/src/tests/tensor/dense_fast_rename_optimizer/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_fast_rename_optimizer/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp b/eval/src/tests/instruction/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp
index 52afde0e92c..043c8814c72 100644
--- a/eval/src/tests/tensor/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp
+++ b/eval/src/tests/instruction/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp
@@ -2,8 +2,8 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
-#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_fast_rename_optimizer.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -13,7 +13,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_inplace_join_function/CMakeLists.txt b/eval/src/tests/instruction/dense_inplace_join_function/CMakeLists.txt
index 2808675bc78..2808675bc78 100644
--- a/eval/src/tests/tensor/dense_inplace_join_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_inplace_join_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_inplace_join_function/dense_inplace_join_function_test.cpp b/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp
index 853607ae76d..68aa72428b9 100644
--- a/eval/src/tests/tensor/dense_inplace_join_function/dense_inplace_join_function_test.cpp
+++ b/eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp
@@ -11,7 +11,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_pow_as_map_optimizer/CMakeLists.txt b/eval/src/tests/instruction/dense_pow_as_map_optimizer/CMakeLists.txt
index d6ce9f1924c..d6ce9f1924c 100644
--- a/eval/src/tests/tensor/dense_pow_as_map_optimizer/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_pow_as_map_optimizer/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp b/eval/src/tests/instruction/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp
index d00744bcfaf..67567b4e289 100644
--- a/eval/src/tests/tensor/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp
+++ b/eval/src/tests/instruction/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_simple_map_function.h>
+#include <vespa/eval/instruction/dense_simple_map_function.h>
#include <vespa/eval/eval/test/eval_fixture.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/vespalib/gtest/gtest.h>
@@ -11,7 +11,6 @@ using namespace vespalib::eval::operation;
using namespace vespalib::eval::tensor_function;
using namespace vespalib::eval::test;
using namespace vespalib::eval;
-using namespace vespalib::tensor;
//using namespace vespalib;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_remove_dimension_optimizer/CMakeLists.txt b/eval/src/tests/instruction/dense_remove_dimension_optimizer/CMakeLists.txt
index c945bd31609..c945bd31609 100644
--- a/eval/src/tests/tensor/dense_remove_dimension_optimizer/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_remove_dimension_optimizer/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp b/eval/src/tests/instruction/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp
index 69910e27b4b..4c3c86be7f8 100644
--- a/eval/src/tests/tensor/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp
+++ b/eval/src/tests/instruction/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp
@@ -2,8 +2,8 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
-#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_fast_rename_optimizer.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -13,7 +13,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_replace_type_function/CMakeLists.txt b/eval/src/tests/instruction/dense_replace_type_function/CMakeLists.txt
index dd4a8a58082..dd4a8a58082 100644
--- a/eval/src/tests/tensor/dense_replace_type_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_replace_type_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_replace_type_function/dense_replace_type_function_test.cpp b/eval/src/tests/instruction/dense_replace_type_function/dense_replace_type_function_test.cpp
index 2612869e72f..6b8e6faecf4 100644
--- a/eval/src/tests/tensor/dense_replace_type_function/dense_replace_type_function_test.cpp
+++ b/eval/src/tests/instruction/dense_replace_type_function/dense_replace_type_function_test.cpp
@@ -4,18 +4,17 @@
#include <vespa/eval/eval/fast_value.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/eval/interpreted_function.h>
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
using namespace vespalib::eval::tensor_function;
using namespace vespalib::eval::test;
using namespace vespalib::eval;
-using namespace vespalib::tensor;
using namespace vespalib;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
-TypedCells getCellsRef(const eval::Value &value) {
+TypedCells getCellsRef(const Value &value) {
return value.cells();
}
diff --git a/eval/src/tests/tensor/dense_simple_join_function/CMakeLists.txt b/eval/src/tests/instruction/dense_simple_join_function/CMakeLists.txt
index 8a2df392145..8a2df392145 100644
--- a/eval/src/tests/tensor/dense_simple_join_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_simple_join_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp b/eval/src/tests/instruction/dense_simple_join_function/dense_simple_join_function_test.cpp
index 6ad60d2e3f5..2186d49385e 100644
--- a/eval/src/tests/tensor/dense_simple_join_function/dense_simple_join_function_test.cpp
+++ b/eval/src/tests/instruction/dense_simple_join_function/dense_simple_join_function_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_simple_join_function.h>
+#include <vespa/eval/instruction/dense_simple_join_function.h>
#include <vespa/eval/eval/test/eval_fixture.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
@@ -11,7 +11,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
using vespalib::make_string_short::fmt;
@@ -19,7 +18,7 @@ using vespalib::make_string_short::fmt;
using Primary = DenseSimpleJoinFunction::Primary;
using Overlap = DenseSimpleJoinFunction::Overlap;
-namespace vespalib::tensor {
+namespace vespalib::eval {
std::ostream &operator<<(std::ostream &os, Primary primary)
{
diff --git a/eval/src/tests/tensor/dense_simple_map_function/CMakeLists.txt b/eval/src/tests/instruction/dense_simple_map_function/CMakeLists.txt
index 8d3bb8c92aa..8d3bb8c92aa 100644
--- a/eval/src/tests/tensor/dense_simple_map_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_simple_map_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_simple_map_function/dense_simple_map_function_test.cpp b/eval/src/tests/instruction/dense_simple_map_function/dense_simple_map_function_test.cpp
index 53164ad59c8..13a24c13a2e 100644
--- a/eval/src/tests/tensor/dense_simple_map_function/dense_simple_map_function_test.cpp
+++ b/eval/src/tests/instruction/dense_simple_map_function/dense_simple_map_function_test.cpp
@@ -1,7 +1,7 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_simple_map_function.h>
+#include <vespa/eval/instruction/dense_simple_map_function.h>
#include <vespa/eval/eval/test/eval_fixture.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/vespalib/gtest/gtest.h>
@@ -10,7 +10,6 @@ using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
using namespace vespalib::eval::tensor_function;
-using namespace vespalib::tensor;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_single_reduce_function/CMakeLists.txt b/eval/src/tests/instruction/dense_single_reduce_function/CMakeLists.txt
index 42b00699c31..42b00699c31 100644
--- a/eval/src/tests/tensor/dense_single_reduce_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_single_reduce_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_single_reduce_function/dense_single_reduce_function_test.cpp b/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp
index 347228269cf..c6da0b94de3 100644
--- a/eval/src/tests/tensor/dense_single_reduce_function/dense_single_reduce_function_test.cpp
+++ b/eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp
@@ -3,7 +3,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
#include <vespa/eval/eval/operation.h>
-#include <vespa/eval/tensor/dense/dense_single_reduce_function.h>
+#include <vespa/eval/instruction/dense_single_reduce_function.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -13,7 +13,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_tensor_create_function/CMakeLists.txt b/eval/src/tests/instruction/dense_tensor_create_function/CMakeLists.txt
index 883f331bda8..883f331bda8 100644
--- a/eval/src/tests/tensor/dense_tensor_create_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/dense_tensor_create_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/dense_tensor_create_function/dense_tensor_create_function_test.cpp b/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp
index edf999e97b3..25bbe5b422c 100644
--- a/eval/src/tests/tensor/dense_tensor_create_function/dense_tensor_create_function_test.cpp
+++ b/eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/dense_tensor_create_function.h>
+#include <vespa/eval/instruction/dense_tensor_create_function.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -12,7 +12,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/vector_from_doubles_function/CMakeLists.txt b/eval/src/tests/instruction/vector_from_doubles_function/CMakeLists.txt
index 5b2e47ec498..5b2e47ec498 100644
--- a/eval/src/tests/tensor/vector_from_doubles_function/CMakeLists.txt
+++ b/eval/src/tests/instruction/vector_from_doubles_function/CMakeLists.txt
diff --git a/eval/src/tests/tensor/vector_from_doubles_function/vector_from_doubles_function_test.cpp b/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp
index c3e1f2f248e..4f4829c3ae1 100644
--- a/eval/src/tests/tensor/vector_from_doubles_function/vector_from_doubles_function_test.cpp
+++ b/eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp
@@ -2,7 +2,7 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/eval/tensor_function.h>
-#include <vespa/eval/tensor/dense/vector_from_doubles_function.h>
+#include <vespa/eval/instruction/vector_from_doubles_function.h>
#include <vespa/eval/eval/test/tensor_model.hpp>
#include <vespa/eval/eval/test/eval_fixture.h>
@@ -12,7 +12,6 @@
using namespace vespalib;
using namespace vespalib::eval;
using namespace vespalib::eval::test;
-using namespace vespalib::tensor;
using namespace vespalib::eval::tensor_function;
const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get();
diff --git a/eval/src/tests/tensor/dense_dimension_combiner/CMakeLists.txt b/eval/src/tests/tensor/dense_dimension_combiner/CMakeLists.txt
deleted file mode 100644
index eaee8ebb4e4..00000000000
--- a/eval/src/tests/tensor/dense_dimension_combiner/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-vespa_add_executable(eval_dense_dimension_combiner_test_app TEST
- SOURCES
- dense_dimension_combiner_test.cpp
- DEPENDS
- vespaeval
-)
-vespa_add_test(NAME eval_dense_dimension_combiner_test_app COMMAND eval_dense_dimension_combiner_test_app)
diff --git a/eval/src/tests/tensor/dense_dimension_combiner/dense_dimension_combiner_test.cpp b/eval/src/tests/tensor/dense_dimension_combiner/dense_dimension_combiner_test.cpp
deleted file mode 100644
index b8949e3a7e6..00000000000
--- a/eval/src/tests/tensor/dense_dimension_combiner/dense_dimension_combiner_test.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/eval/tensor/dense/dense_dimension_combiner.h>
-
-using namespace vespalib;
-using namespace vespalib::eval;
-using namespace vespalib::tensor;
-
-void verifyLeft(DenseDimensionCombiner &d, size_t last) {
- d.commonReset();
- d.leftReset();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
- size_t expect = 0;
- while (d.leftInRange()) {
- d.stepLeft();
- EXPECT_GREATER(d.leftIdx(), expect);
- expect = d.leftIdx();
- }
- EXPECT_FALSE(d.leftInRange());
- EXPECT_EQUAL(expect, last);
- d.leftReset();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
-}
-
-void verifyRight(DenseDimensionCombiner &d, size_t last) {
- d.commonReset();
- d.rightReset();
- EXPECT_TRUE(d.rightInRange());
- EXPECT_EQUAL(d.rightIdx(), 0u);
- size_t expect = 0;
- while (d.rightInRange()) {
- d.stepRight();
- EXPECT_GREATER(d.rightIdx(), expect);
- expect = d.rightIdx();
- }
- EXPECT_FALSE(d.rightInRange());
- EXPECT_EQUAL(expect, last);
- d.rightReset();
- EXPECT_TRUE(d.rightInRange());
- EXPECT_EQUAL(d.rightIdx(), 0u);
-}
-
-
-TEST("require that one left, one common, one right dimension works") {
- ValueType t12_lc = ValueType::tensor_type({{"d1_l", 3},{"d2_c", 4}});
- ValueType t23_cr = ValueType::tensor_type({{"d2_c", 4},{"d3_r", 5}});
-
- DenseDimensionCombiner d(t12_lc, t23_cr);
-
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
- EXPECT_EQUAL(d.rightIdx(), 0u);
- EXPECT_EQUAL(d.outputIdx(), 0u);
-
- d.stepCommon();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 1u);
- EXPECT_EQUAL(d.rightIdx(), 5u);
- EXPECT_EQUAL(d.outputIdx(), 5u);
-
- d.stepRight();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 1u);
- EXPECT_EQUAL(d.rightIdx(), 6u);
- EXPECT_EQUAL(d.outputIdx(), 6u);
-
- d.stepLeft();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 5u);
- EXPECT_EQUAL(d.rightIdx(), 6u);
- EXPECT_EQUAL(d.outputIdx(), 26u);
-
- d.stepLeft();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 9u);
- EXPECT_EQUAL(d.rightIdx(), 6u);
- EXPECT_EQUAL(d.outputIdx(), 46u);
-
- d.stepLeft();
- EXPECT_FALSE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 13u);
- EXPECT_EQUAL(d.rightIdx(), 6u);
- EXPECT_EQUAL(d.outputIdx(), 6u);
-
- d.leftReset();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 1u);
- EXPECT_EQUAL(d.rightIdx(), 6u);
- EXPECT_EQUAL(d.outputIdx(), 6u);
-
- d.stepCommon();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 2u);
- EXPECT_EQUAL(d.rightIdx(), 11u);
- EXPECT_EQUAL(d.outputIdx(), 11u);
-
- d.stepRight();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 2u);
- EXPECT_EQUAL(d.rightIdx(), 12u);
- EXPECT_EQUAL(d.outputIdx(), 12u);
-
- TEST_DO(verifyLeft(d, 12));
- TEST_DO(verifyRight(d, 20));
-}
-
-TEST("require that two left, no common, two right dimensions works") {
- ValueType t12_ll = ValueType::tensor_type({{"d1_l", 3},{"d2_l", 4}});
- ValueType t34_rr = ValueType::tensor_type({{"d3_r", 5},{"d4_r", 2}});
-
- DenseDimensionCombiner d(t12_ll, t34_rr);
-
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
- EXPECT_EQUAL(d.rightIdx(), 0u);
- EXPECT_EQUAL(d.outputIdx(), 0u);
-
- d.stepCommon();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_FALSE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
- EXPECT_EQUAL(d.rightIdx(), 0u);
- EXPECT_EQUAL(d.outputIdx(), 120u);
-
- d.commonReset();
- d.stepRight();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 0u);
- EXPECT_EQUAL(d.rightIdx(), 1u);
- EXPECT_EQUAL(d.outputIdx(), 1u);
-
- d.stepLeft();
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 1u);
- EXPECT_EQUAL(d.rightIdx(), 1u);
- EXPECT_EQUAL(d.outputIdx(), 11u);
-
- d.stepLeft();
- d.stepLeft();
- d.stepLeft();
- d.stepLeft();
- d.stepLeft();
- d.stepLeft();
- d.stepLeft();
-
- EXPECT_TRUE(d.leftInRange());
- EXPECT_TRUE(d.rightInRange());
- EXPECT_TRUE(d.commonInRange());
- EXPECT_EQUAL(d.leftIdx(), 8u);
- EXPECT_EQUAL(d.rightIdx(), 1u);
- EXPECT_EQUAL(d.outputIdx(), 81u);
-
- TEST_DO(verifyLeft(d, 12));
- TEST_DO(verifyRight(d, 10));
-}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/eval/src/tests/tensor/direct_sparse_tensor_builder/CMakeLists.txt b/eval/src/tests/tensor/direct_sparse_tensor_builder/CMakeLists.txt
deleted file mode 100644
index 00ff230fadd..00000000000
--- a/eval/src/tests/tensor/direct_sparse_tensor_builder/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-vespa_add_executable(eval_direct_sparse_tensor_builder_test_app TEST
- SOURCES
- direct_sparse_tensor_builder_test.cpp
- DEPENDS
- vespaeval
-)
-vespa_add_test(NAME eval_direct_sparse_tensor_builder_test_app COMMAND eval_direct_sparse_tensor_builder_test_app)
diff --git a/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp b/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp
deleted file mode 100644
index bcee6471f76..00000000000
--- a/eval/src/tests/tensor/direct_sparse_tensor_builder/direct_sparse_tensor_builder_test.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/eval/tensor/sparse/direct_sparse_tensor_builder.h>
-#include <vespa/eval/tensor/sparse/sparse_tensor_address_combiner.h>
-#include <vespa/vespalib/test/insertion_operators.h>
-
-using namespace vespalib::tensor;
-using namespace vespalib::tensor::sparse;
-using vespalib::eval::TensorSpec;
-using vespalib::eval::CellType;
-using vespalib::eval::ValueType;
-
-void
-assertCellValue(double expValue, const TensorAddress &address,
- const ValueType &type,
- const SparseTensor &tensor)
-{
- SparseTensorAddressBuilder addressBuilder;
- auto dimsItr = type.dimensions().cbegin();
- auto dimsItrEnd = type.dimensions().cend();
- for (const auto &element : address.elements()) {
- while ((dimsItr < dimsItrEnd) && (dimsItr->name < element.dimension())) {
- addressBuilder.add("");
- ++dimsItr;
- }
- assert((dimsItr != dimsItrEnd) && (dimsItr->name == element.dimension()));
- addressBuilder.add(element.label());
- ++dimsItr;
- }
- while (dimsItr < dimsItrEnd) {
- addressBuilder.add("");
- ++dimsItr;
- }
- SparseTensorAddressRef addressRef(addressBuilder.getAddressRef());
- size_t idx;
- bool found = tensor.index().lookup_address(addressRef, idx);
- EXPECT_TRUE(found);
- auto cells = tensor.cells();
- if (EXPECT_TRUE(cells.type == CellType::DOUBLE)) {
- auto arr = cells.typify<double>();
- EXPECT_EQUAL(expValue, arr[idx]);
- }
-}
-
-Tensor::UP
-buildTensor()
-{
- DirectSparseTensorBuilder<double> builder(ValueType::from_spec("tensor(a{},b{},c{},d{})"));
- SparseTensorAddressBuilder address;
- address.set({"1", "2", "", ""});
- builder.insertCell(address, 10);
- address.set({"", "", "3", "4"});
- builder.insertCell(address, 20);
- return builder.build();
-}
-
-TEST("require that tensor can be constructed")
-{
- Tensor::UP tensor = buildTensor();
- const SparseTensor &sparseTensor = dynamic_cast<const SparseTensor &>(*tensor);
- const ValueType &type = sparseTensor.type();
- const auto & index = sparseTensor.index();
- EXPECT_EQUAL(2u, index.size());
- assertCellValue(10, TensorAddress({{"a","1"},{"b","2"}}), type, sparseTensor);
- assertCellValue(20, TensorAddress({{"c","3"},{"d","4"}}), type, sparseTensor);
-}
-
-TEST("require that tensor can be converted to tensor spec")
-{
- Tensor::UP tensor = buildTensor();
- TensorSpec expSpec("tensor(a{},b{},c{},d{})");
- expSpec.add({{"a", "1"}, {"b", "2"}, {"c", ""}, {"d", ""}}, 10).
- add({{"a", ""},{"b",""},{"c", "3"}, {"d", "4"}}, 20);
- TensorSpec actSpec = tensor->toSpec();
- EXPECT_EQUAL(expSpec, actSpec);
-}
-
-TEST("require that dimensions are extracted")
-{
- Tensor::UP tensor = buildTensor();
- const SparseTensor &sparseTensor = dynamic_cast<const SparseTensor &>(*tensor);
- const auto &dims = sparseTensor.type().dimensions();
- EXPECT_EQUAL(4u, dims.size());
- EXPECT_EQUAL("a", dims[0].name);
- EXPECT_EQUAL("b", dims[1].name);
- EXPECT_EQUAL("c", dims[2].name);
- EXPECT_EQUAL("d", dims[3].name);
- EXPECT_EQUAL("tensor(a{},b{},c{},d{})", sparseTensor.type().to_spec());
-}
-
-void verifyAddressCombiner(const ValueType & a, const ValueType & b, size_t numDim, size_t numOverlapping) {
- TensorAddressCombiner combiner(a, b);
- EXPECT_EQUAL(numDim, combiner.numDimensions());
- EXPECT_EQUAL(numOverlapping, combiner.numOverlappingDimensions());
-}
-TEST("Test sparse tensor address combiner") {
- verifyAddressCombiner(ValueType::tensor_type({{"a"}}), ValueType::tensor_type({{"b"}}), 2, 0);
- verifyAddressCombiner(ValueType::tensor_type({{"a"}, {"b"}}), ValueType::tensor_type({{"b"}}), 2, 1);
- verifyAddressCombiner(ValueType::tensor_type({{"a"}, {"b"}}), ValueType::tensor_type({{"b"}, {"c"}}), 3, 1);
-
-}
-
-TEST("Test essential object sizes") {
- EXPECT_EQUAL(16u, sizeof(SparseTensorAddressRef));
- EXPECT_EQUAL(24u, sizeof(std::pair<SparseTensorAddressRef, double>));
- EXPECT_EQUAL(32u, sizeof(vespalib::hash_node<std::pair<SparseTensorAddressRef, double>>));
- Tensor::UP tensor = buildTensor();
- size_t used = tensor->get_memory_usage().usedBytes();
- EXPECT_GREATER(used, sizeof(SparseTensor));
- EXPECT_LESS(used, 10000u);
- size_t allocated = tensor->get_memory_usage().allocatedBytes();
- EXPECT_GREATER(allocated, used);
- EXPECT_LESS(allocated, 50000u);
- fprintf(stderr, "tensor using %zu bytes of %zu allocated\n",
- used, allocated);
-}
-
-TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
index 618715a885f..aa1da07bc91 100644
--- a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
+++ b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
@@ -48,7 +48,6 @@
using namespace vespalib;
using namespace vespalib::eval;
-using namespace vespalib::tensor;
using namespace vespalib::eval::instruction;
using vespalib::make_string_short::fmt;
diff --git a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
index 7e204f1ea06..b474d2458b9 100644
--- a/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
+++ b/eval/src/tests/tensor/onnx_wrapper/onnx_wrapper_test.cpp
@@ -6,7 +6,6 @@
#include <vespa/vespalib/gtest/gtest.h>
using namespace vespalib::eval;
-using namespace vespalib::tensor;
using vespalib::make_string_short::fmt;
using TensorInfo = Onnx::TensorInfo;
diff --git a/eval/src/tests/tensor/tensor_address/tensor_address_test.cpp b/eval/src/tests/tensor/tensor_address/tensor_address_test.cpp
index c12b7071d02..a0a062c4322 100644
--- a/eval/src/tests/tensor/tensor_address/tensor_address_test.cpp
+++ b/eval/src/tests/tensor/tensor_address/tensor_address_test.cpp
@@ -3,8 +3,6 @@
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/eval/tensor/tensor_address.h>
-using namespace vespalib::tensor;
-
void
assertSortOrder(const TensorAddress::Elements &exp,
const TensorAddress::Elements &input)
diff --git a/eval/src/vespa/eval/eval/optimize_tensor_function.cpp b/eval/src/vespa/eval/eval/optimize_tensor_function.cpp
index ed0b122196d..cbd4192a84f 100644
--- a/eval/src/vespa/eval/eval/optimize_tensor_function.cpp
+++ b/eval/src/vespa/eval/eval/optimize_tensor_function.cpp
@@ -8,18 +8,18 @@
#include <vespa/eval/instruction/dense_xw_product_function.h>
#include <vespa/eval/instruction/dense_matmul_function.h>
#include <vespa/eval/instruction/dense_multi_matmul_function.h>
-#include <vespa/eval/tensor/dense/dense_fast_rename_optimizer.h>
-#include <vespa/eval/tensor/dense/dense_add_dimension_optimizer.h>
-#include <vespa/eval/tensor/dense/dense_single_reduce_function.h>
-#include <vespa/eval/tensor/dense/dense_remove_dimension_optimizer.h>
+#include <vespa/eval/instruction/dense_fast_rename_optimizer.h>
+#include <vespa/eval/instruction/dense_add_dimension_optimizer.h>
+#include <vespa/eval/instruction/dense_single_reduce_function.h>
+#include <vespa/eval/instruction/dense_remove_dimension_optimizer.h>
#include <vespa/eval/instruction/dense_lambda_peek_optimizer.h>
#include <vespa/eval/instruction/dense_simple_expand_function.h>
-#include <vespa/eval/tensor/dense/dense_simple_join_function.h>
+#include <vespa/eval/instruction/dense_simple_join_function.h>
#include <vespa/eval/instruction/join_with_number_function.h>
-#include <vespa/eval/tensor/dense/dense_pow_as_map_optimizer.h>
-#include <vespa/eval/tensor/dense/dense_simple_map_function.h>
-#include <vespa/eval/tensor/dense/vector_from_doubles_function.h>
-#include <vespa/eval/tensor/dense/dense_tensor_create_function.h>
+#include <vespa/eval/instruction/dense_pow_as_map_optimizer.h>
+#include <vespa/eval/instruction/dense_simple_map_function.h>
+#include <vespa/eval/instruction/vector_from_doubles_function.h>
+#include <vespa/eval/instruction/dense_tensor_create_function.h>
#include <vespa/eval/instruction/dense_tensor_peek_function.h>
#include <vespa/log/log.h>
@@ -29,8 +29,6 @@ namespace vespalib::eval {
namespace {
-using namespace vespalib::tensor;
-
const TensorFunction &optimize_for_factory(const ValueBuilderFactory &factory, const TensorFunction &expr, Stash &stash) {
if (&factory == &SimpleValueBuilderFactory::get()) {
// never optimize simple value evaluation
diff --git a/eval/src/vespa/eval/eval/tensor_function.h b/eval/src/vespa/eval/eval/tensor_function.h
index 26d28bac350..ed1106cccc1 100644
--- a/eval/src/vespa/eval/eval/tensor_function.h
+++ b/eval/src/vespa/eval/eval/tensor_function.h
@@ -21,9 +21,6 @@ namespace vespalib {
class Stash;
class ObjectVisitor;
-// TODO: remove this type injection when the 'tensor' namespace is removed
-namespace tensor { using ValueBuilderFactory = vespalib::eval::ValueBuilderFactory; }
-
namespace eval {
class Tensor;
diff --git a/eval/src/vespa/eval/eval/value_type.cpp b/eval/src/vespa/eval/eval/value_type.cpp
index 05ec65bf292..a5960a8de4b 100644
--- a/eval/src/vespa/eval/eval/value_type.cpp
+++ b/eval/src/vespa/eval/eval/value_type.cpp
@@ -138,7 +138,7 @@ struct Renamer {
bool matched_all() const { return (match_cnt == from.size()); }
};
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
constexpr ValueType::Dimension::size_type ValueType::Dimension::npos;
diff --git a/eval/src/vespa/eval/instruction/CMakeLists.txt b/eval/src/vespa/eval/instruction/CMakeLists.txt
index 4f2c59e34e1..42f88c0ee52 100644
--- a/eval/src/vespa/eval/instruction/CMakeLists.txt
+++ b/eval/src/vespa/eval/instruction/CMakeLists.txt
@@ -22,4 +22,14 @@ vespa_add_library(eval_instruction OBJECT
generic_rename.cpp
index_lookup_table.cpp
join_with_number_function.cpp
+ dense_add_dimension_optimizer.cpp
+ dense_fast_rename_optimizer.cpp
+ dense_pow_as_map_optimizer.cpp
+ dense_remove_dimension_optimizer.cpp
+ dense_replace_type_function.cpp
+ dense_simple_join_function.cpp
+ dense_simple_map_function.cpp
+ dense_single_reduce_function.cpp
+ dense_tensor_create_function.cpp
+ vector_from_doubles_function.cpp
)
diff --git a/eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.cpp
index 9cd7cc88907..ccccb595c6d 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.cpp
@@ -8,13 +8,10 @@
#include <vespa/log/log.h>
LOG_SETUP(".eval.tensor.dense.add_dimension_optimizer");
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::ValueType;
-using eval::TensorFunction;
-using eval::as;
-using namespace eval::tensor_function;
-using namespace eval::operation;
+using namespace tensor_function;
+using namespace operation;
namespace {
@@ -34,10 +31,10 @@ bool is_unit_constant(const TensorFunction &node) {
return false;
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
const TensorFunction &
-DenseAddDimensionOptimizer::optimize(const eval::TensorFunction &expr, Stash &stash)
+DenseAddDimensionOptimizer::optimize(const TensorFunction &expr, Stash &stash)
{
if (auto join = as<Join>(expr)) {
const TensorFunction &lhs = join->lhs();
@@ -57,4 +54,4 @@ DenseAddDimensionOptimizer::optimize(const eval::TensorFunction &expr, Stash &st
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.h b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h
index 4b5cf296292..99ab20614a2 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_add_dimension_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h
@@ -4,14 +4,15 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient adding of dimensions with
* size 1 for dense tensors.
+ * TODO: extend to mixed tensors.
**/
struct DenseAddDimensionOptimizer {
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.cpp
index bd84fc4c51a..a4ef32f4701 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.cpp
@@ -4,13 +4,9 @@
#include "dense_replace_type_function.h"
#include <vespa/eval/eval/value.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::Value;
-using eval::ValueType;
-using eval::TensorFunction;
-using eval::as;
-using namespace eval::tensor_function;
+using namespace tensor_function;
namespace {
@@ -35,10 +31,10 @@ bool is_dense_stable_rename(const ValueType &from_type, const ValueType &to_type
return true;
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
const TensorFunction &
-DenseFastRenameOptimizer::optimize(const eval::TensorFunction &expr, Stash &stash)
+DenseFastRenameOptimizer::optimize(const TensorFunction &expr, Stash &stash)
{
if (auto rename = as<Rename>(expr)) {
const ValueType &from_type = rename->child().result_type();
@@ -51,4 +47,4 @@ DenseFastRenameOptimizer::optimize(const eval::TensorFunction &expr, Stash &stas
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.h b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h
index bbcb38e1f80..2882cdf6f30 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_fast_rename_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h
@@ -4,14 +4,15 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient non-transposing rename of a
* dense tensor.
+ * TODO: extend to mixed tensors.
**/
struct DenseFastRenameOptimizer {
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp
index 6853b1a078f..f8ce886ae1f 100644
--- a/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp
@@ -3,7 +3,7 @@
#include "dense_lambda_peek_optimizer.h"
#include "dense_lambda_peek_function.h"
#include "dense_cell_range_function.h"
-#include <vespa/eval/tensor/dense/dense_replace_type_function.h>
+#include <vespa/eval/instruction/dense_replace_type_function.h>
#include <vespa/eval/eval/value.h>
#include <vespa/eval/eval/node_tools.h>
#include <vespa/eval/eval/basic_nodes.h>
@@ -182,7 +182,7 @@ DenseLambdaPeekOptimizer::optimize(const TensorFunction &expr, Stash &stash)
if (result.cell_range && (dst_type.cell_type() == src_type.cell_type())) {
auto cell_range = result.cell_range.value();
if (cell_range.is_full(src_type.dense_subspace_size())) {
- return tensor::DenseReplaceTypeFunction::create_compact(dst_type, get_param, stash);
+ return DenseReplaceTypeFunction::create_compact(dst_type, get_param, stash);
} else {
return stash.create<DenseCellRangeFunction>(dst_type, get_param,
cell_range.offset, cell_range.length);
diff --git a/eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.cpp
index f78c23c80ac..61ef2243480 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.cpp
@@ -4,13 +4,10 @@
#include "dense_simple_map_function.h"
#include <vespa/eval/eval/operation.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::TensorFunction;
-using eval::as;
-
-using namespace eval::tensor_function;
-using namespace eval::operation;
+using namespace tensor_function;
+using namespace operation;
const TensorFunction &
DensePowAsMapOptimizer::optimize(const TensorFunction &expr, Stash &stash)
@@ -35,4 +32,4 @@ DensePowAsMapOptimizer::optimize(const TensorFunction &expr, Stash &stash)
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.h b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h
index 4849a10c070..e61069b87b0 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_pow_as_map_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h
@@ -4,15 +4,16 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for converting join expressions on the
* form 'join(tensor,<small integer constant>,f(x,y)(pow(x,y))' to
* expressions on the form 'map(tensor,f(x)(x*x...))'.
+ * TODO: extend to mixed tensors.
**/
struct DensePowAsMapOptimizer {
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.cpp b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.cpp
index a48527e83f5..fc7f31fb421 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.cpp
@@ -4,13 +4,9 @@
#include "dense_replace_type_function.h"
#include <vespa/eval/eval/value_type.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::Aggr;
-using eval::ValueType;
-using eval::TensorFunction;
-using eval::as;
-using namespace eval::tensor_function;
+using namespace tensor_function;
namespace {
@@ -25,16 +21,16 @@ bool is_trivial_dim_list(const ValueType &type, const std::vector<vespalib::stri
return true;
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
const TensorFunction &
-DenseRemoveDimensionOptimizer::optimize(const eval::TensorFunction &expr, Stash &stash)
+DenseRemoveDimensionOptimizer::optimize(const TensorFunction &expr, Stash &stash)
{
if (auto reduce = as<Reduce>(expr)) {
const TensorFunction &child = reduce->child();
if (expr.result_type().is_dense() &&
child.result_type().is_dense() &&
- eval::aggr::is_ident(reduce->aggr()) &&
+ aggr::is_ident(reduce->aggr()) &&
is_trivial_dim_list(child.result_type(), reduce->dimensions()))
{
assert(expr.result_type().cell_type() == child.result_type().cell_type());
@@ -44,4 +40,4 @@ DenseRemoveDimensionOptimizer::optimize(const eval::TensorFunction &expr, Stash
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.h b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h
index 64b057a62d8..2b4e3588caf 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_remove_dimension_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h
@@ -4,14 +4,15 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient removal of dimensions with
* size 1 for dense tensors.
+ * TODO: extend to mixed tensors.
**/
struct DenseRemoveDimensionOptimizer {
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/dense_replace_type_function.cpp b/eval/src/vespa/eval/instruction/dense_replace_type_function.cpp
new file mode 100644
index 00000000000..81d3ca67880
--- /dev/null
+++ b/eval/src/vespa/eval/instruction/dense_replace_type_function.cpp
@@ -0,0 +1,48 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "dense_replace_type_function.h"
+#include <vespa/eval/eval/value.h>
+
+namespace vespalib::eval {
+
+using namespace tensor_function;
+
+namespace {
+
+void my_replace_type_op(InterpretedFunction::State &state, uint64_t param) {
+ const ValueType &type = unwrap_param<ValueType>(param);
+ TypedCells cells = state.peek(0).cells();
+ state.pop_push(state.stash.create<DenseValueView>(type, cells));
+}
+
+} // namespace vespalib::eval::<unnamed>
+
+DenseReplaceTypeFunction::DenseReplaceTypeFunction(const ValueType &result_type,
+ const TensorFunction &child)
+ : tensor_function::Op1(result_type, child)
+{
+}
+
+DenseReplaceTypeFunction::~DenseReplaceTypeFunction()
+{
+}
+
+InterpretedFunction::Instruction
+DenseReplaceTypeFunction::compile_self(const ValueBuilderFactory &, Stash &) const
+{
+ return InterpretedFunction::Instruction(my_replace_type_op, wrap_param<ValueType>(result_type()));
+}
+
+const DenseReplaceTypeFunction &
+DenseReplaceTypeFunction::create_compact(const ValueType &result_type,
+ const TensorFunction &child,
+ Stash &stash)
+{
+ if (auto replace = as<DenseReplaceTypeFunction>(child)) {
+ return stash.create<DenseReplaceTypeFunction>(result_type, replace->child());
+ } else {
+ return stash.create<DenseReplaceTypeFunction>(result_type, child);
+ }
+}
+
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_replace_type_function.h b/eval/src/vespa/eval/instruction/dense_replace_type_function.h
index adf5023b0cb..78ce163aceb 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_replace_type_function.h
+++ b/eval/src/vespa/eval/instruction/dense_replace_type_function.h
@@ -4,23 +4,24 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function for efficient type-only modification of dense
* tensor.
+ * TODO: extend to handling any tensor, dense/mixed/sparse.
**/
-class DenseReplaceTypeFunction : public eval::tensor_function::Op1
+class DenseReplaceTypeFunction : public tensor_function::Op1
{
public:
- DenseReplaceTypeFunction(const eval::ValueType &result_type,
- const eval::TensorFunction &child);
+ DenseReplaceTypeFunction(const ValueType &result_type,
+ const TensorFunction &child);
~DenseReplaceTypeFunction();
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
bool result_is_mutable() const override { return child().result_is_mutable(); }
- static const DenseReplaceTypeFunction &create_compact(const eval::ValueType &result_type,
- const eval::TensorFunction &child,
+ static const DenseReplaceTypeFunction &create_compact(const ValueType &result_type,
+ const TensorFunction &child,
Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_simple_join_function.cpp b/eval/src/vespa/eval/instruction/dense_simple_join_function.cpp
index 21b47b67291..76d020eef9d 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_simple_join_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_simple_join_function.cpp
@@ -9,28 +9,19 @@
#include <optional>
#include <algorithm>
-namespace vespalib::tensor {
+namespace vespalib::eval {
using vespalib::ArrayRef;
-using eval::CellType;
-using eval::DenseValueView;
-using eval::TensorFunction;
-using eval::TypedCells;
-using eval::TypifyCellType;
-using eval::Value;
-using eval::ValueType;
-using eval::as;
-
-using namespace eval::operation;
-using namespace eval::tensor_function;
+using namespace operation;
+using namespace tensor_function;
using Primary = DenseSimpleJoinFunction::Primary;
using Overlap = DenseSimpleJoinFunction::Overlap;
-using op_function = eval::InterpretedFunction::op_function;
-using Instruction = eval::InterpretedFunction::Instruction;
-using State = eval::InterpretedFunction::State;
+using op_function = InterpretedFunction::op_function;
+using Instruction = InterpretedFunction::Instruction;
+using State = InterpretedFunction::State;
namespace {
@@ -67,7 +58,7 @@ template <typename LCT, typename RCT, typename Fun, bool swap, Overlap overlap,
void my_simple_join_op(State &state, uint64_t param) {
using PCT = typename std::conditional<swap,RCT,LCT>::type;
using SCT = typename std::conditional<swap,LCT,RCT>::type;
- using OCT = typename eval::UnifyCellTypes<PCT,SCT>::type;
+ using OCT = typename UnifyCellTypes<PCT,SCT>::type;
using OP = typename std::conditional<swap,SwapArgs2<Fun>,Fun>::type;
const JoinParams &params = unwrap_param<JoinParams>(param);
OP my_op(params.function);
@@ -151,7 +142,7 @@ std::optional<Overlap> detect_overlap(const TensorFunction &lhs, const TensorFun
return (primary == Primary::LHS) ? detect_overlap(lhs, rhs) : detect_overlap(rhs, lhs);
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
//-----------------------------------------------------------------------------
@@ -221,4 +212,4 @@ DenseSimpleJoinFunction::optimize(const TensorFunction &expr, Stash &stash)
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_simple_join_function.h b/eval/src/vespa/eval/instruction/dense_simple_join_function.h
index 4cb4a0fc4ff..8fa0be9d021 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_simple_join_function.h
+++ b/eval/src/vespa/eval/instruction/dense_simple_join_function.h
@@ -5,23 +5,25 @@
#include <vespa/eval/eval/tensor_function.h>
#include <vespa/eval/eval/operation.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function for simple join operations on dense tensors.
+ * TODO: consider if this is useful anymore, maybe we just need
+ * to handle inplace.
**/
-class DenseSimpleJoinFunction : public eval::tensor_function::Join
+class DenseSimpleJoinFunction : public tensor_function::Join
{
- using Super = eval::tensor_function::Join;
+ using Super = tensor_function::Join;
public:
enum class Primary : uint8_t { LHS, RHS };
enum class Overlap : uint8_t { INNER, OUTER, FULL };
- using join_fun_t = vespalib::eval::operation::op2_t;
+ using join_fun_t = operation::op2_t;
private:
Primary _primary;
Overlap _overlap;
public:
- DenseSimpleJoinFunction(const eval::ValueType &result_type,
+ DenseSimpleJoinFunction(const ValueType &result_type,
const TensorFunction &lhs,
const TensorFunction &rhs,
join_fun_t function_in,
@@ -32,8 +34,8 @@ public:
Overlap overlap() const { return _overlap; }
bool primary_is_mutable() const;
size_t factor() const;
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_simple_map_function.cpp b/eval/src/vespa/eval/instruction/dense_simple_map_function.cpp
index 5227b67dd92..ec7d2014436 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_simple_map_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_simple_map_function.cpp
@@ -6,24 +6,16 @@
#include <vespa/eval/eval/operation.h>
#include <vespa/eval/eval/inline_operation.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
using vespalib::ArrayRef;
-using eval::DenseValueView;
-using eval::TensorFunction;
-using eval::TypedCells;
-using eval::TypifyCellType;
-using eval::Value;
-using eval::ValueType;
-using eval::as;
+using namespace operation;
+using namespace tensor_function;
-using namespace eval::operation;
-using namespace eval::tensor_function;
-
-using op_function = eval::InterpretedFunction::op_function;
-using Instruction = eval::InterpretedFunction::Instruction;
-using State = eval::InterpretedFunction::State;
+using op_function = InterpretedFunction::op_function;
+using Instruction = InterpretedFunction::Instruction;
+using State = InterpretedFunction::State;
namespace {
@@ -58,7 +50,7 @@ struct MyGetFun {
using MyTypify = TypifyValue<TypifyCellType,TypifyOp1,TypifyBool>;
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
//-----------------------------------------------------------------------------
@@ -90,4 +82,4 @@ DenseSimpleMapFunction::optimize(const TensorFunction &expr, Stash &stash)
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/dense_simple_map_function.h b/eval/src/vespa/eval/instruction/dense_simple_map_function.h
new file mode 100644
index 00000000000..40432f35c58
--- /dev/null
+++ b/eval/src/vespa/eval/instruction/dense_simple_map_function.h
@@ -0,0 +1,26 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/eval/eval/tensor_function.h>
+
+namespace vespalib::eval {
+
+/**
+ * Tensor function for simple map operations on dense tensors.
+ * TODO: Fix generic map to handle inplace, and remove this.
+ **/
+class DenseSimpleMapFunction : public tensor_function::Map
+{
+public:
+ using map_fun_t = operation::op1_t;
+ DenseSimpleMapFunction(const ValueType &result_type,
+ const TensorFunction &child,
+ map_fun_t function_in);
+ ~DenseSimpleMapFunction() override;
+ bool inplace() const { return child().result_is_mutable(); }
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
+};
+
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.cpp b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp
index c10fd6c0fe7..53e91f729ee 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp
@@ -5,21 +5,10 @@
#include <vespa/eval/eval/value.h>
#include <cassert>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::Aggr;
-using eval::DenseValueView;
-using eval::InterpretedFunction;
-using eval::TensorFunction;
-using eval::Value;
-using eval::ValueType;
-using eval::TypedCells;
-using eval::TypifyCellType;
-using eval::TypifyAggr;
-using eval::as;
-
-using namespace eval::tensor_function;
-using namespace eval::aggr;
+using namespace tensor_function;
+using namespace aggr;
namespace {
@@ -166,7 +155,7 @@ template <typename T> struct VectorLookupLoop {
const T &get() const { return list[index]; }
};
-DenseSingleReduceSpec extract_next(const eval::ValueType &type, eval::Aggr aggr,
+DenseSingleReduceSpec extract_next(const ValueType &type, Aggr aggr,
std::vector<vespalib::string> &todo)
{
size_t outer_size = 1;
@@ -200,10 +189,10 @@ DenseSingleReduceSpec extract_next(const eval::ValueType &type, eval::Aggr aggr,
return {type.reduce(do_now), outer_size, reduce_size, inner_size, aggr};
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
std::vector<DenseSingleReduceSpec>
-make_dense_single_reduce_list(const eval::ValueType &type, eval::Aggr aggr,
+make_dense_single_reduce_list(const ValueType &type, Aggr aggr,
const std::vector<vespalib::string> &reduce_dims)
{
auto res_type = type.reduce(reduce_dims);
@@ -217,7 +206,7 @@ make_dense_single_reduce_list(const eval::ValueType &type, eval::Aggr aggr,
curr_type = list.back().result_type;
}
assert(curr_type == res_type);
- if ((list.size() > 1) && !eval::aggr::is_simple(aggr)) {
+ if ((list.size() > 1) && !aggr::is_simple(aggr)) {
return {};
}
return list;
@@ -261,4 +250,4 @@ DenseSingleReduceFunction::optimize(const TensorFunction &expr, Stash &stash)
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.h b/eval/src/vespa/eval/instruction/dense_single_reduce_function.h
index 8bdcf82d4ab..ed68bd48c15 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_single_reduce_function.h
+++ b/eval/src/vespa/eval/instruction/dense_single_reduce_function.h
@@ -4,14 +4,14 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
struct DenseSingleReduceSpec {
- eval::ValueType result_type;
+ ValueType result_type;
size_t outer_size;
size_t reduce_size;
size_t inner_size;
- eval::Aggr aggr;
+ Aggr aggr;
};
/**
@@ -20,7 +20,7 @@ struct DenseSingleReduceSpec {
* fails.
**/
std::vector<DenseSingleReduceSpec>
-make_dense_single_reduce_list(const eval::ValueType &type, eval::Aggr aggr,
+make_dense_single_reduce_list(const ValueType &type, Aggr aggr,
const std::vector<vespalib::string> &reduce_dims);
/**
@@ -30,26 +30,28 @@ make_dense_single_reduce_list(const eval::ValueType &type, eval::Aggr aggr,
* operation. Adjacent reduced dimensions will be handled is if they
* were a single dimension. Trivial dimensions will be trivially
* reduced along with any other dimension.
+ * TODO: consider if we should extend this to handling mixed tensors
+ * (handling the spare part as a batch dimension).
**/
-class DenseSingleReduceFunction : public eval::tensor_function::Op1
+class DenseSingleReduceFunction : public tensor_function::Op1
{
private:
size_t _outer_size;
size_t _reduce_size;
size_t _inner_size;
- eval::Aggr _aggr;
+ Aggr _aggr;
public:
DenseSingleReduceFunction(const DenseSingleReduceSpec &spec,
- const eval::TensorFunction &child);
+ const TensorFunction &child);
~DenseSingleReduceFunction() override;
size_t outer_size() const { return _outer_size; }
size_t reduce_size() const { return _reduce_size; }
size_t inner_size() const { return _inner_size; }
- eval::Aggr aggr() const { return _aggr; }
+ Aggr aggr() const { return _aggr; }
bool result_is_mutable() const override { return true; }
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.cpp b/eval/src/vespa/eval/instruction/dense_tensor_create_function.cpp
index c233a51a473..0f41158c36e 100644
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_tensor_create_function.cpp
@@ -3,23 +3,15 @@
#include "dense_tensor_create_function.h"
#include <vespa/eval/eval/value.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::DenseValueView;
-using eval::DoubleValue;
-using eval::TensorFunction;
-using eval::TensorSpec;
-using eval::TypedCells;
-using eval::Value;
-using eval::ValueType;
-using Child = eval::TensorFunction::Child;
-using eval::as;
-using namespace eval::tensor_function;
+using Child = TensorFunction::Child;
+using namespace tensor_function;
namespace {
template <typename CT>
-void my_tensor_create_op(eval::InterpretedFunction::State &state, uint64_t param) {
+void my_tensor_create_op(InterpretedFunction::State &state, uint64_t param) {
const auto &self = unwrap_param<DenseTensorCreateFunction::Self>(param);
size_t pending_cells = self.result_size;
ArrayRef<CT> cells = state.stash.create_uninitialized_array<CT>(pending_cells);
@@ -48,7 +40,7 @@ size_t get_index(const TensorSpec::Address &addr, const ValueType &type) {
return cell_idx;
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
DenseTensorCreateFunction::DenseTensorCreateFunction(const ValueType &res_type, std::vector<Child> children)
: TensorFunction(),
@@ -67,16 +59,16 @@ DenseTensorCreateFunction::push_children(std::vector<Child::CREF> &target) const
}
}
-eval::InterpretedFunction::Instruction
+InterpretedFunction::Instruction
DenseTensorCreateFunction::compile_self(const ValueBuilderFactory &, Stash &) const
{
- using MyTypify = eval::TypifyCellType;
+ using MyTypify = TypifyCellType;
auto op = typify_invoke<1,MyTypify,MyTensorCreateOp>(result_type().cell_type());
- return eval::InterpretedFunction::Instruction(op, wrap_param<DenseTensorCreateFunction::Self>(_self));
+ return InterpretedFunction::Instruction(op, wrap_param<DenseTensorCreateFunction::Self>(_self));
}
const TensorFunction &
-DenseTensorCreateFunction::optimize(const eval::TensorFunction &expr, Stash &stash)
+DenseTensorCreateFunction::optimize(const TensorFunction &expr, Stash &stash)
{
if (auto create = as<Create>(expr)) {
if (expr.result_type().is_dense()) {
@@ -94,4 +86,4 @@ DenseTensorCreateFunction::optimize(const eval::TensorFunction &expr, Stash &sta
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/dense_tensor_create_function.h b/eval/src/vespa/eval/instruction/dense_tensor_create_function.h
new file mode 100644
index 00000000000..9af912ba788
--- /dev/null
+++ b/eval/src/vespa/eval/instruction/dense_tensor_create_function.h
@@ -0,0 +1,34 @@
+// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/eval/eval/tensor_function.h>
+
+namespace vespalib::eval {
+
+/**
+ * Tensor function for creating a dense tensor from double values.
+ * TODO: benchmark how useful this is, maybe we can just drop it.
+ */
+class DenseTensorCreateFunction : public TensorFunction
+{
+public:
+ struct Self {
+ ValueType result_type;
+ size_t result_size;
+ Self(const ValueType &r, size_t n) : result_type(r), result_size(n) {}
+ };
+private:
+ Self _self;
+ std::vector<Child> _children;
+public:
+ DenseTensorCreateFunction(const ValueType &res_type, std::vector<Child> children);
+ ~DenseTensorCreateFunction();
+ const ValueType &result_type() const override { return _self.result_type; }
+ void push_children(std::vector<Child::CREF> &children) const override;
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ bool result_is_mutable() const override { return true; }
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
+};
+
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/generic_join.h b/eval/src/vespa/eval/instruction/generic_join.h
index e5ddf388211..988286be980 100644
--- a/eval/src/vespa/eval/instruction/generic_join.h
+++ b/eval/src/vespa/eval/instruction/generic_join.h
@@ -12,7 +12,7 @@ namespace vespalib::eval { struct ValueBuilderFactory; }
namespace vespalib::eval::instruction {
-using join_fun_t = vespalib::eval::operation::op2_t;
+using join_fun_t = operation::op2_t;
//-----------------------------------------------------------------------------
diff --git a/eval/src/vespa/eval/instruction/generic_lambda.cpp b/eval/src/vespa/eval/instruction/generic_lambda.cpp
index 5685f199b9e..f4f8c84a257 100644
--- a/eval/src/vespa/eval/instruction/generic_lambda.cpp
+++ b/eval/src/vespa/eval/instruction/generic_lambda.cpp
@@ -59,7 +59,7 @@ struct CompiledParams {
};
template <typename CT>
-void my_compiled_lambda_op(eval::InterpretedFunction::State &state, uint64_t param) {
+void my_compiled_lambda_op(InterpretedFunction::State &state, uint64_t param) {
const CompiledParams &params = unwrap_param<CompiledParams>(param);
std::vector<double> args(params.result_type.dimensions().size() + params.bindings.size(), 0.0);
double *bind_next = &args[params.result_type.dimensions().size()];
@@ -98,7 +98,7 @@ struct InterpretedParams {
};
template <typename CT>
-void my_interpreted_lambda_op(eval::InterpretedFunction::State &state, uint64_t param) {
+void my_interpreted_lambda_op(InterpretedFunction::State &state, uint64_t param) {
const InterpretedParams &params = unwrap_param<InterpretedParams>(param);
std::vector<double> labels(params.result_type.dimensions().size(), 0.0);
ParamProxy param_proxy(labels, *state.params, params.bindings);
@@ -121,7 +121,7 @@ struct MyInterpretedLambdaOp {
} // namespace <unnamed>
Instruction
-GenericLambda::make_instruction(const eval::tensor_function::Lambda &lambda_in,
+GenericLambda::make_instruction(const tensor_function::Lambda &lambda_in,
const ValueBuilderFactory &factory, Stash &stash)
{
const ValueType & result_type = lambda_in.result_type();
diff --git a/eval/src/vespa/eval/instruction/generic_lambda.h b/eval/src/vespa/eval/instruction/generic_lambda.h
index a9a490f0957..a5f4c10e214 100644
--- a/eval/src/vespa/eval/instruction/generic_lambda.h
+++ b/eval/src/vespa/eval/instruction/generic_lambda.h
@@ -10,7 +10,7 @@ namespace vespalib::eval::instruction {
struct GenericLambda {
static InterpretedFunction::Instruction
- make_instruction(const eval::tensor_function::Lambda &lambda_in,
+ make_instruction(const tensor_function::Lambda &lambda_in,
const ValueBuilderFactory &factory, Stash &stash);
};
diff --git a/eval/src/vespa/eval/instruction/generic_map.h b/eval/src/vespa/eval/instruction/generic_map.h
index ad29d2c1073..2c03512a922 100644
--- a/eval/src/vespa/eval/instruction/generic_map.h
+++ b/eval/src/vespa/eval/instruction/generic_map.h
@@ -10,7 +10,7 @@ namespace vespalib::eval { struct ValueBuilderFactory; }
namespace vespalib::eval::instruction {
-using map_fun_t = vespalib::eval::operation::op1_t;
+using map_fun_t = operation::op1_t;
struct GenericMap {
static InterpretedFunction::Instruction
diff --git a/eval/src/vespa/eval/instruction/join_with_number_function.h b/eval/src/vespa/eval/instruction/join_with_number_function.h
index 351f9b005cb..546ff75b175 100644
--- a/eval/src/vespa/eval/instruction/join_with_number_function.h
+++ b/eval/src/vespa/eval/instruction/join_with_number_function.h
@@ -20,7 +20,7 @@ private:
tensor_function::join_fun_t _function;
public:
- JoinWithNumberFunction(const vespalib::eval::tensor_function::Join &original_join, bool number_on_left);
+ JoinWithNumberFunction(const tensor_function::Join &original_join, bool number_on_left);
~JoinWithNumberFunction();
Primary primary() const { return _primary; }
bool inplace() const;
@@ -31,5 +31,5 @@ public:
static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.cpp b/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp
index 19c95c9418d..40bd9e25dfc 100644
--- a/eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.cpp
+++ b/eval/src/vespa/eval/instruction/vector_from_doubles_function.cpp
@@ -3,24 +3,17 @@
#include "vector_from_doubles_function.h"
#include <vespa/eval/eval/value.h>
-namespace vespalib::tensor {
-
-using eval::CellType;
-using eval::DenseValueView;
-using eval::TensorFunction;
-using eval::TypedCells;
-using eval::Value;
-using eval::ValueType;
-using Child = eval::TensorFunction::Child;
-using eval::as;
-using namespace eval::tensor_function;
+namespace vespalib::eval {
+
+using Child = TensorFunction::Child;
+using namespace tensor_function;
namespace {
struct CallVectorFromDoubles {
template <typename CT>
static TypedCells
- invoke(eval::InterpretedFunction::State &state, size_t numCells) {
+ invoke(InterpretedFunction::State &state, size_t numCells) {
ArrayRef<CT> outputCells = state.stash.create_uninitialized_array<CT>(numCells);
for (size_t i = numCells; i-- > 0; ) {
outputCells[i] = (CT) state.peek(0).as_double();
@@ -30,11 +23,11 @@ struct CallVectorFromDoubles {
}
};
-void my_vector_from_doubles_op(eval::InterpretedFunction::State &state, uint64_t param) {
+void my_vector_from_doubles_op(InterpretedFunction::State &state, uint64_t param) {
const auto &self = unwrap_param<VectorFromDoublesFunction::Self>(param);
CellType ct = self.resultType.cell_type();
size_t numCells = self.resultSize;
- using MyTypify = eval::TypifyCellType;
+ using MyTypify = TypifyCellType;
TypedCells cells = typify_invoke<1,MyTypify,CallVectorFromDoubles>(ct, state, numCells);
const Value &result = state.stash.create<DenseValueView>(self.resultType, cells);
state.stack.emplace_back(result);
@@ -72,7 +65,7 @@ std::vector<Child> flatten(const TensorFunction &lhs, const TensorFunction &rhs)
return vec;
}
-} // namespace vespalib::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
VectorFromDoublesFunction::VectorFromDoublesFunction(std::vector<Child> children, const ValueType &res_type)
@@ -92,14 +85,14 @@ VectorFromDoublesFunction::push_children(std::vector<Child::CREF> &target) const
}
}
-eval::InterpretedFunction::Instruction
+InterpretedFunction::Instruction
VectorFromDoublesFunction::compile_self(const ValueBuilderFactory &, Stash &) const
{
- return eval::InterpretedFunction::Instruction(my_vector_from_doubles_op, wrap_param<VectorFromDoublesFunction::Self>(_self));
+ return InterpretedFunction::Instruction(my_vector_from_doubles_op, wrap_param<VectorFromDoublesFunction::Self>(_self));
}
const TensorFunction &
-VectorFromDoublesFunction::optimize(const eval::TensorFunction &expr, Stash &stash)
+VectorFromDoublesFunction::optimize(const TensorFunction &expr, Stash &stash)
{
if (auto concat = as<Concat>(expr)) {
const vespalib::string &dimension = concat->dimension();
@@ -114,4 +107,4 @@ VectorFromDoublesFunction::optimize(const eval::TensorFunction &expr, Stash &sta
return expr;
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.h b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h
index d21a339e7d9..c22ea99f41a 100644
--- a/eval/src/vespa/eval/tensor/dense/vector_from_doubles_function.h
+++ b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h
@@ -4,35 +4,37 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function for a concat forming a vector from double values
+ * TODO: consider removing this, since the user can write a tensor
+ * create expression instead.
*/
-class VectorFromDoublesFunction : public eval::TensorFunction
+class VectorFromDoublesFunction : public TensorFunction
{
public:
struct Self {
- const eval::ValueType resultType;
+ const ValueType resultType;
size_t resultSize;
- Self(const eval::ValueType &r, size_t n) : resultType(r), resultSize(n) {}
+ Self(const ValueType &r, size_t n) : resultType(r), resultSize(n) {}
};
private:
Self _self;
std::vector<Child> _children;
- void add(const eval::TensorFunction &child);
+ void add(const TensorFunction &child);
public:
- VectorFromDoublesFunction(std::vector<Child> children, const eval::ValueType &res_type);
+ VectorFromDoublesFunction(std::vector<Child> children, const ValueType &res_type);
~VectorFromDoublesFunction();
- const eval::ValueType &result_type() const override { return _self.resultType; }
+ const ValueType &result_type() const override { return _self.resultType; }
void push_children(std::vector<Child::CREF> &children) const override;
const vespalib::string &dimension() const {
return _self.resultType.dimensions()[0].name;
}
size_t size() const { return _self.resultSize; }
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
+ InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
bool result_is_mutable() const override { return true; }
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
+ static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp
index 521d2382666..d9c0d659b1e 100644
--- a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp
+++ b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp
@@ -18,16 +18,10 @@ LOG_SETUP(".eval.onnx_wrapper");
using vespalib::ArrayRef;
using vespalib::ConstArrayRef;
-using vespalib::eval::CellType;
-using vespalib::eval::DenseValueView;
-using vespalib::eval::DenseCellsValue;
-using vespalib::eval::TypedCells;
-using vespalib::eval::TypifyCellType;
-using vespalib::eval::ValueType;
using vespalib::make_string_short::fmt;
-namespace vespalib::tensor {
+namespace vespalib::eval {
namespace {
@@ -72,23 +66,23 @@ struct CreateOnnxTensor {
};
struct CreateVespaTensorRef {
- template <typename T> static eval::Value::UP invoke(const eval::ValueType &type_ref, Ort::Value &value) {
+ template <typename T> static Value::UP invoke(const ValueType &type_ref, Ort::Value &value) {
size_t num_cells = type_ref.dense_subspace_size();
ConstArrayRef<T> cells(value.GetTensorMutableData<T>(), num_cells);
return std::make_unique<DenseValueView>(type_ref, TypedCells(cells));
}
- eval::Value::UP operator()(const eval::ValueType &type_ref, Ort::Value &value) {
+ Value::UP operator()(const ValueType &type_ref, Ort::Value &value) {
return typify_invoke<1,MyTypify,CreateVespaTensorRef>(type_ref.cell_type(), type_ref, value);
}
};
struct CreateVespaTensor {
- template <typename T> static eval::Value::UP invoke(const eval::ValueType &type) {
+ template <typename T> static Value::UP invoke(const ValueType &type) {
size_t num_cells = type.dense_subspace_size();
std::vector<T> cells(num_cells, T{});
return std::make_unique<DenseCellsValue<T>>(type, std::move(cells));
}
- eval::Value::UP operator()(const eval::ValueType &type) {
+ Value::UP operator()(const ValueType &type) {
return typify_invoke<1,MyTypify,CreateVespaTensor>(type.cell_type(), type);
}
};
@@ -205,7 +199,7 @@ Onnx::TensorInfo make_tensor_info(const OnnxString &name, const Ort::TypeInfo &t
return Onnx::TensorInfo{vespalib::string(name.get()), make_dimensions(tensor_info), make_element_type(element_type)};
}
-std::vector<int64_t> extract_sizes(const eval::ValueType &type) {
+std::vector<int64_t> extract_sizes(const ValueType &type) {
std::vector<int64_t> sizes;
for (const auto &dim: type.dimensions()) {
sizes.push_back(dim.size);
@@ -246,7 +240,7 @@ Onnx::WireInfo::~WireInfo() = default;
Onnx::WirePlanner::~WirePlanner() = default;
bool
-Onnx::WirePlanner::bind_input_type(const eval::ValueType &vespa_in, const TensorInfo &onnx_in)
+Onnx::WirePlanner::bind_input_type(const ValueType &vespa_in, const TensorInfo &onnx_in)
{
const auto &type = vespa_in;
const auto &name = onnx_in.name;
@@ -275,7 +269,7 @@ Onnx::WirePlanner::bind_input_type(const eval::ValueType &vespa_in, const Tensor
return true;
}
-eval::ValueType
+ValueType
Onnx::WirePlanner::make_output_type(const TensorInfo &onnx_out) const
{
const auto &dimensions = onnx_out.dimensions;
@@ -347,7 +341,7 @@ Ort::AllocatorWithDefaultOptions Onnx::EvalContext::_alloc;
template <typename T>
void
-Onnx::EvalContext::adapt_param(EvalContext &self, size_t idx, const eval::Value &param)
+Onnx::EvalContext::adapt_param(EvalContext &self, size_t idx, const Value &param)
{
const auto &cells_ref = param.cells();
auto cells = unconstify(cells_ref.typify<T>());
@@ -357,7 +351,7 @@ Onnx::EvalContext::adapt_param(EvalContext &self, size_t idx, const eval::Value
template <typename SRC, typename DST>
void
-Onnx::EvalContext::convert_param(EvalContext &self, size_t idx, const eval::Value &param)
+Onnx::EvalContext::convert_param(EvalContext &self, size_t idx, const Value &param)
{
auto cells = param.cells().typify<SRC>();
size_t n = cells.size();
@@ -384,21 +378,21 @@ Onnx::EvalContext::convert_result(EvalContext &self, size_t idx)
struct Onnx::EvalContext::SelectAdaptParam {
template <typename ...Ts> static auto invoke() { return adapt_param<Ts...>; }
- auto operator()(eval::CellType ct) {
+ auto operator()(CellType ct) {
return typify_invoke<1,MyTypify,SelectAdaptParam>(ct);
}
};
struct Onnx::EvalContext::SelectConvertParam {
template <typename ...Ts> static auto invoke() { return convert_param<Ts...>; }
- auto operator()(eval::CellType ct, Onnx::ElementType et) {
+ auto operator()(CellType ct, Onnx::ElementType et) {
return typify_invoke<2,MyTypify,SelectConvertParam>(ct, et);
}
};
struct Onnx::EvalContext::SelectConvertResult {
template <typename ...Ts> static auto invoke() { return convert_result<Ts...>; }
- auto operator()(Onnx::ElementType et, eval::CellType ct) {
+ auto operator()(Onnx::ElementType et, CellType ct) {
return typify_invoke<2,MyTypify,SelectConvertResult>(et, ct);
}
};
@@ -452,7 +446,7 @@ Onnx::EvalContext::EvalContext(const Onnx &model, const WireInfo &wire_info)
Onnx::EvalContext::~EvalContext() = default;
void
-Onnx::EvalContext::bind_param(size_t i, const eval::Value &param)
+Onnx::EvalContext::bind_param(size_t i, const Value &param)
{
_param_binders[i](*this, i, param);
}
@@ -470,7 +464,7 @@ Onnx::EvalContext::eval()
}
}
-const eval::Value &
+const Value &
Onnx::EvalContext::get_result(size_t i) const
{
return *_results[i];
diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.h b/eval/src/vespa/eval/onnx/onnx_wrapper.h
index f42b926d17e..68c31f04cdc 100644
--- a/eval/src/vespa/eval/onnx/onnx_wrapper.h
+++ b/eval/src/vespa/eval/onnx/onnx_wrapper.h
@@ -16,7 +16,7 @@
namespace vespalib::eval { struct Value; }
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Wrapper around an ONNX model handeled by onnxruntime.
@@ -72,24 +72,24 @@ public:
// how the model should be wired with inputs/outputs
struct WireInfo {
- std::vector<eval::ValueType> vespa_inputs;
+ std::vector<ValueType> vespa_inputs;
std::vector<Onnx::TensorType> onnx_inputs;
std::vector<Onnx::TensorType> onnx_outputs;
- std::vector<eval::ValueType> vespa_outputs;
+ std::vector<ValueType> vespa_outputs;
~WireInfo();
};
// planning how we should wire the model based on input types
class WirePlanner {
private:
- std::map<vespalib::string,eval::ValueType> _input_types;
+ std::map<vespalib::string,ValueType> _input_types;
std::map<vespalib::string,size_t> _symbolic_sizes;
std::set<size_t> _bound_unknown_sizes;
public:
WirePlanner() : _input_types(), _symbolic_sizes(), _bound_unknown_sizes() {}
~WirePlanner();
- bool bind_input_type(const eval::ValueType &vespa_in, const TensorInfo &onnx_in);
- eval::ValueType make_output_type(const TensorInfo &onnx_out) const;
+ bool bind_input_type(const ValueType &vespa_in, const TensorInfo &onnx_in);
+ ValueType make_output_type(const TensorInfo &onnx_out) const;
WireInfo get_wire_info(const Onnx &model) const;
};
@@ -98,7 +98,7 @@ public:
// output values are pre-allocated and will not change
class EvalContext {
private:
- using param_fun_t = void (*)(EvalContext &, size_t i, const eval::Value &);
+ using param_fun_t = void (*)(EvalContext &, size_t i, const Value &);
using result_fun_t = void (*)(EvalContext &, size_t i);
static Ort::AllocatorWithDefaultOptions _alloc;
@@ -108,15 +108,15 @@ public:
Ort::MemoryInfo _cpu_memory;
std::vector<Ort::Value> _param_values;
std::vector<Ort::Value> _result_values;
- std::vector<eval::Value::UP> _results;
+ std::vector<Value::UP> _results;
std::vector<param_fun_t> _param_binders;
std::vector<std::pair<size_t,result_fun_t>> _result_converters;
template <typename T>
- static void adapt_param(EvalContext &self, size_t idx, const eval::Value &param);
+ static void adapt_param(EvalContext &self, size_t idx, const Value &param);
template <typename SRC, typename DST>
- static void convert_param(EvalContext &self, size_t idx, const eval::Value &param);
+ static void convert_param(EvalContext &self, size_t idx, const Value &param);
template <typename SRC, typename DST>
static void convert_result(EvalContext &self, size_t idx);
@@ -130,9 +130,9 @@ public:
~EvalContext();
size_t num_params() const { return _param_values.size(); }
size_t num_results() const { return _result_values.size(); }
- void bind_param(size_t i, const eval::Value &param);
+ void bind_param(size_t i, const Value &param);
void eval();
- const eval::Value &get_result(size_t i) const;
+ const Value &get_result(size_t i) const;
};
private:
diff --git a/eval/src/vespa/eval/tensor/dense/CMakeLists.txt b/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
index 8e506890b20..d561df80d14 100644
--- a/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
+++ b/eval/src/vespa/eval/tensor/dense/CMakeLists.txt
@@ -1,15 +1,5 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(eval_tensor_dense OBJECT
SOURCES
- dense_add_dimension_optimizer.cpp
- dense_fast_rename_optimizer.cpp
- dense_pow_as_map_optimizer.cpp
- dense_remove_dimension_optimizer.cpp
- dense_replace_type_function.cpp
- dense_simple_join_function.cpp
- dense_simple_map_function.cpp
- dense_single_reduce_function.cpp
- dense_tensor_create_function.cpp
mutable_dense_tensor_view.cpp
- vector_from_doubles_function.cpp
)
diff --git a/eval/src/vespa/eval/tensor/dense/dense_replace_type_function.cpp b/eval/src/vespa/eval/tensor/dense/dense_replace_type_function.cpp
deleted file mode 100644
index ed75d6fff98..00000000000
--- a/eval/src/vespa/eval/tensor/dense/dense_replace_type_function.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "dense_replace_type_function.h"
-#include <vespa/eval/eval/value.h>
-
-namespace vespalib::tensor {
-
-using eval::DenseValueView;
-using eval::TypedCells;
-using eval::Value;
-using eval::ValueType;
-using eval::TensorFunction;
-using eval::as;
-using namespace eval::tensor_function;
-
-namespace {
-
-void my_replace_type_op(eval::InterpretedFunction::State &state, uint64_t param) {
- const ValueType &type = unwrap_param<ValueType>(param);
- TypedCells cells = state.peek(0).cells();
- state.pop_push(state.stash.create<DenseValueView>(type, cells));
-}
-
-} // namespace vespalib::tensor::<unnamed>
-
-DenseReplaceTypeFunction::DenseReplaceTypeFunction(const eval::ValueType &result_type,
- const eval::TensorFunction &child)
- : eval::tensor_function::Op1(result_type, child)
-{
-}
-
-DenseReplaceTypeFunction::~DenseReplaceTypeFunction()
-{
-}
-
-eval::InterpretedFunction::Instruction
-DenseReplaceTypeFunction::compile_self(const ValueBuilderFactory &, Stash &) const
-{
- return eval::InterpretedFunction::Instruction(my_replace_type_op, wrap_param<ValueType>(result_type()));
-}
-
-const DenseReplaceTypeFunction &
-DenseReplaceTypeFunction::create_compact(const eval::ValueType &result_type,
- const eval::TensorFunction &child,
- Stash &stash)
-{
- if (auto replace = as<DenseReplaceTypeFunction>(child)) {
- return stash.create<DenseReplaceTypeFunction>(result_type, replace->child());
- } else {
- return stash.create<DenseReplaceTypeFunction>(result_type, child);
- }
-}
-
-} // namespace vespalib::tensor
diff --git a/eval/src/vespa/eval/tensor/dense/dense_simple_map_function.h b/eval/src/vespa/eval/tensor/dense/dense_simple_map_function.h
deleted file mode 100644
index 02a81ec137b..00000000000
--- a/eval/src/vespa/eval/tensor/dense/dense_simple_map_function.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/eval/eval/tensor_function.h>
-
-namespace vespalib::tensor {
-
-/**
- * Tensor function for simple map operations on dense tensors.
- **/
-class DenseSimpleMapFunction : public eval::tensor_function::Map
-{
-public:
- using map_fun_t = vespalib::eval::operation::op1_t;
- DenseSimpleMapFunction(const eval::ValueType &result_type,
- const TensorFunction &child,
- map_fun_t function_in);
- ~DenseSimpleMapFunction() override;
- bool inplace() const { return child().result_is_mutable(); }
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
-};
-
-} // namespace vespalib::tensor
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp
deleted file mode 100644
index 26f9194c8ce..00000000000
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "dense_tensor.h"
-#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/exceptions.h>
-
-using vespalib::eval::TensorSpec;
-
-namespace vespalib::tensor {
-
-namespace {
-
-size_t
-calcCellsSize(const eval::ValueType &type)
-{
- size_t cellsSize = 1;
- for (const auto &dim : type.dimensions()) {
- cellsSize *= dim.size;
- }
- return cellsSize;
-}
-
-template<typename T>
-void
-checkCellsSize(const DenseTensor<T> &arg)
-{
- auto cellsSize = calcCellsSize(arg.fast_type());
- if (arg.cells().size != cellsSize) {
- throw IllegalStateException(make_string("Wrong cell size, "
- "expected=%zu, "
- "actual=%zu",
- cellsSize,
- arg.cells().size));
- }
- if (arg.fast_type().cell_type() != arg.cells().type) {
- throw IllegalStateException(make_string("Wrong cell type, "
- "expected=%u, "
- "actual=%u",
- (unsigned char)arg.fast_type().cell_type(),
- (unsigned char)arg.cells().type));
- }
-}
-
-}
-
-template <typename CT>
-DenseTensor<CT>::DenseTensor(eval::ValueType type_in,
- std::vector<CT> &&cells_in)
- : DenseTensorView(_type),
- _type(std::move(type_in)),
- _cells(std::move(cells_in))
-{
- initCellsRef(TypedCells(_cells));
- checkCellsSize(*this);
-}
-
-template <typename CT>
-DenseTensor<CT>::~DenseTensor() = default;
-
-template <typename CT>
-template <typename RCT>
-bool
-DenseTensor<CT>::operator==(const DenseTensor<RCT> &rhs) const
-{
- if (_type != rhs._type) return false;
- if (_cells.size != rhs._cells.size) return false;
- for (size_t i = 0; i < _cells.size; i++) {
- if (_cells[i] != rhs._cells[i]) return false;
- }
- return true;
-}
-
-template class DenseTensor<float>;
-template class DenseTensor<double>;
-
-}
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.h b/eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.h
deleted file mode 100644
index c0c238a2a89..00000000000
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor_create_function.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/eval/eval/tensor_function.h>
-
-namespace vespalib::tensor {
-
-/**
- * Tensor function for creating a dense tensor from double values.
- */
-class DenseTensorCreateFunction : public eval::TensorFunction
-{
-public:
- struct Self {
- eval::ValueType result_type;
- size_t result_size;
- Self(const eval::ValueType &r, size_t n) : result_type(r), result_size(n) {}
- };
-private:
- Self _self;
- std::vector<Child> _children;
-public:
- DenseTensorCreateFunction(const eval::ValueType &res_type, std::vector<Child> children);
- ~DenseTensorCreateFunction();
- const eval::ValueType &result_type() const override { return _self.result_type; }
- void push_children(std::vector<Child::CREF> &children) const override;
- eval::InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
- bool result_is_mutable() const override { return true; }
- static const eval::TensorFunction &optimize(const eval::TensorFunction &expr, Stash &stash);
-};
-
-} // namespace vespalib::tensor
diff --git a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp b/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp
deleted file mode 100644
index 385da6d1fcd..00000000000
--- a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-
-#include "typed_dense_tensor_builder.h"
-
-namespace vespalib::tensor {
-
-using Address = DenseTensorView::Address;
-using eval::ValueType;
-
-namespace {
-
-size_t
-calculateCellsSize(const ValueType &type)
-{
- size_t cellsSize = 1;
- for (const auto &dim : type.dimensions()) {
- cellsSize *= dim.size;
- }
- return cellsSize;
-}
-
-} // namespace
-
-template <typename CT>
-TypedDenseTensorBuilder<CT>::~TypedDenseTensorBuilder() = default;
-
-template <typename CT>
-TypedDenseTensorBuilder<CT>::TypedDenseTensorBuilder(const ValueType &type_in)
- : _type(type_in),
- _cells(calculateCellsSize(_type))
-{
- assert(vespalib::eval::check_cell_type<CT>(_type.cell_type()));
-}
-
-template <typename CT>
-Tensor::UP
-TypedDenseTensorBuilder<CT>::build()
-{
- return std::make_unique<DenseTensor<CT>>(std::move(_type), std::move(_cells));
-}
-
-template class TypedDenseTensorBuilder<double>;
-template class TypedDenseTensorBuilder<float>;
-
-} // namespace
diff --git a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h b/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h
deleted file mode 100644
index 770ea4ae5ea..00000000000
--- a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include "dense_tensor.h"
-
-namespace vespalib::tensor {
-
-/**
- * Class for building a dense tensor by inserting cell values directly into underlying array of cells.
- */
-template <typename CT>
-class TypedDenseTensorBuilder
-{
-public:
- using Address = DenseTensorView::Address;
-private:
- eval::ValueType _type;
- std::vector<CT> _cells;
-
- static size_t calculateCellAddress(const Address &address, const eval::ValueType &type) {
- size_t result = 0;
- for (size_t i = 0; i < address.size(); ++i) {
- result *= type.dimensions()[i].size;
- result += address[i];
- }
- return result;
- }
-public:
- TypedDenseTensorBuilder(const eval::ValueType &type_in);
- ~TypedDenseTensorBuilder();
- void insertCell(const Address &address, CT cellValue) {
- insertCell(calculateCellAddress(address, _type), cellValue);
- }
- void insertCell(size_t index, CT cellValue) {
- _cells[index] = cellValue;
- }
- Tensor::UP build();
-};
-
-}
diff --git a/searchlib/src/vespa/searchlib/features/onnx_feature.cpp b/searchlib/src/vespa/searchlib/features/onnx_feature.cpp
index c3655e8ed2a..87e5ef2a5c2 100644
--- a/searchlib/src/vespa/searchlib/features/onnx_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/onnx_feature.cpp
@@ -20,7 +20,7 @@ using search::fef::ParameterList;
using vespalib::Stash;
using vespalib::eval::ValueType;
using vespalib::make_string_short::fmt;
-using vespalib::tensor::Onnx;
+using vespalib::eval::Onnx;
namespace search::features {
diff --git a/searchlib/src/vespa/searchlib/features/onnx_feature.h b/searchlib/src/vespa/searchlib/features/onnx_feature.h
index f5a94cc5345..5a45b26f1f6 100644
--- a/searchlib/src/vespa/searchlib/features/onnx_feature.h
+++ b/searchlib/src/vespa/searchlib/features/onnx_feature.h
@@ -12,7 +12,7 @@ namespace search::features {
**/
class OnnxBlueprint : public fef::Blueprint {
private:
- using Onnx = vespalib::tensor::Onnx;
+ using Onnx = vespalib::eval::Onnx;
std::unique_ptr<Onnx> _model;
Onnx::WireInfo _wire_info;
public: