aboutsummaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-12-09 15:41:04 +0000
committerArne Juul <arnej@verizonmedia.com>2020-12-09 16:01:15 +0000
commitf78045f9cfe63423e401ab7ac6c8fbc248b1fc14 (patch)
tree09f9272e18586436c9141a1c2812a7a62623f94e /eval
parentb7d222356f3b0f9676a733c0e2a73405ab124b63 (diff)
move to vespalib::eval namespace
Diffstat (limited to 'eval')
-rw-r--r--eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp2
-rw-r--r--eval/src/tests/instruction/dense_add_dimension_optimizer/dense_add_dimension_optimizer_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_fast_rename_optimizer/dense_fast_rename_optimizer_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_inplace_join_function/dense_inplace_join_function_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_pow_as_map_optimizer/dense_pow_as_map_optimizer_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_remove_dimension_optimizer/dense_remove_dimension_optimizer_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_replace_type_function/dense_replace_type_function_test.cpp3
-rw-r--r--eval/src/tests/instruction/dense_simple_join_function/dense_simple_join_function_test.cpp3
-rw-r--r--eval/src/tests/instruction/dense_simple_map_function/dense_simple_map_function_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_single_reduce_function/dense_single_reduce_function_test.cpp1
-rw-r--r--eval/src/tests/instruction/dense_tensor_create_function/dense_tensor_create_function_test.cpp1
-rw-r--r--eval/src/tests/instruction/vector_from_doubles_function/vector_from_doubles_function_test.cpp1
-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.cpp2
-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/dense_add_dimension_optimizer.cpp15
-rw-r--r--eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h6
-rw-r--r--eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.cpp14
-rw-r--r--eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h6
-rw-r--r--eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp2
-rw-r--r--eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.cpp11
-rw-r--r--eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h6
-rw-r--r--eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.cpp16
-rw-r--r--eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h6
-rw-r--r--eval/src/vespa/eval/instruction/dense_replace_type_function.cpp30
-rw-r--r--eval/src/vespa/eval/instruction/dense_replace_type_function.h16
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_join_function.cpp27
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_join_function.h16
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_map_function.cpp24
-rw-r--r--eval/src/vespa/eval/instruction/dense_simple_map_function.h14
-rw-r--r--eval/src/vespa/eval/instruction/dense_single_reduce_function.cpp27
-rw-r--r--eval/src/vespa/eval/instruction/dense_single_reduce_function.h22
-rw-r--r--eval/src/vespa/eval/instruction/dense_tensor_create_function.cpp28
-rw-r--r--eval/src/vespa/eval/instruction/dense_tensor_create_function.h18
-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.cpp31
-rw-r--r--eval/src/vespa/eval/instruction/vector_from_doubles_function.h20
-rw-r--r--eval/src/vespa/eval/onnx/onnx_wrapper.cpp36
-rw-r--r--eval/src/vespa/eval/onnx/onnx_wrapper.h24
46 files changed, 185 insertions, 274 deletions
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 bb71cf090ae..7094686e399 100644
--- a/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
+++ b/eval/src/tests/eval/tensor_lambda/tensor_lambda_test.cpp
@@ -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/instruction/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 1812cc8c1db..e7660ce8933 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 7339a057fa3..043c8814c72 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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/instruction/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/instruction/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 0e73a40b81a..67567b4e289 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 32f2fb20c10..4c3c86be7f8 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 46fd674e15c..6b8e6faecf4 100644
--- a/eval/src/tests/instruction/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
@@ -10,12 +10,11 @@
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/instruction/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 e367f94d7d9..2186d49385e 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 dc2a5ac77c1..13a24c13a2e 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 d9a6a14108f..c6da0b94de3 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 c063415957a..25bbe5b422c 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction/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 1cbfade6c45..4f4829c3ae1 100644
--- a/eval/src/tests/instruction/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
@@ -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/instruction_benchmark/instruction_benchmark.cpp b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
index 3bddf69f53f..2beaacb7723 100644
--- a/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
+++ b/eval/src/tests/tensor/instruction_benchmark/instruction_benchmark.cpp
@@ -44,7 +44,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 97c565f1106..cbd4192a84f 100644
--- a/eval/src/vespa/eval/eval/optimize_tensor_function.cpp
+++ b/eval/src/vespa/eval/eval/optimize_tensor_function.cpp
@@ -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/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/instruction/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/instruction/dense_add_dimension_optimizer.h b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h
index 8d52c835261..99ab20614a2 100644
--- a/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_add_dimension_optimizer.h
@@ -4,7 +4,7 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient adding of dimensions with
@@ -12,7 +12,7 @@ namespace vespalib::tensor {
* 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/instruction/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/instruction/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/instruction/dense_fast_rename_optimizer.h b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h
index 0543c7117b9..2882cdf6f30 100644
--- a/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_fast_rename_optimizer.h
@@ -4,7 +4,7 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient non-transposing rename of a
@@ -12,7 +12,7 @@ namespace vespalib::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 cdf1629bf2b..f8ce886ae1f 100644
--- a/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp
+++ b/eval/src/vespa/eval/instruction/dense_lambda_peek_optimizer.cpp
@@ -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/instruction/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/instruction/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/instruction/dense_pow_as_map_optimizer.h b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h
index 6231db0e4bd..e61069b87b0 100644
--- a/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_pow_as_map_optimizer.h
@@ -4,7 +4,7 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for converting join expressions on the
@@ -13,7 +13,7 @@ namespace vespalib::tensor {
* 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/instruction/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/instruction/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/instruction/dense_remove_dimension_optimizer.h b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h
index 2551bf4f072..2b4e3588caf 100644
--- a/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h
+++ b/eval/src/vespa/eval/instruction/dense_remove_dimension_optimizer.h
@@ -4,7 +4,7 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
/**
* Tensor function optimizer for efficient removal of dimensions with
@@ -12,7 +12,7 @@ namespace vespalib::tensor {
* 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
index ed75d6fff98..81d3ca67880 100644
--- a/eval/src/vespa/eval/instruction/dense_replace_type_function.cpp
+++ b/eval/src/vespa/eval/instruction/dense_replace_type_function.cpp
@@ -3,29 +3,23 @@
#include "dense_replace_type_function.h"
#include <vespa/eval/eval/value.h>
-namespace vespalib::tensor {
+namespace vespalib::eval {
-using eval::DenseValueView;
-using eval::TypedCells;
-using eval::Value;
-using eval::ValueType;
-using eval::TensorFunction;
-using eval::as;
-using namespace eval::tensor_function;
+using namespace tensor_function;
namespace {
-void my_replace_type_op(eval::InterpretedFunction::State &state, uint64_t param) {
+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::tensor::<unnamed>
+} // namespace vespalib::eval::<unnamed>
-DenseReplaceTypeFunction::DenseReplaceTypeFunction(const eval::ValueType &result_type,
- const eval::TensorFunction &child)
- : eval::tensor_function::Op1(result_type, child)
+DenseReplaceTypeFunction::DenseReplaceTypeFunction(const ValueType &result_type,
+ const TensorFunction &child)
+ : tensor_function::Op1(result_type, child)
{
}
@@ -33,15 +27,15 @@ DenseReplaceTypeFunction::~DenseReplaceTypeFunction()
{
}
-eval::InterpretedFunction::Instruction
+InterpretedFunction::Instruction
DenseReplaceTypeFunction::compile_self(const ValueBuilderFactory &, Stash &) const
{
- return eval::InterpretedFunction::Instruction(my_replace_type_op, wrap_param<ValueType>(result_type()));
+ return 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,
+DenseReplaceTypeFunction::create_compact(const ValueType &result_type,
+ const TensorFunction &child,
Stash &stash)
{
if (auto replace = as<DenseReplaceTypeFunction>(child)) {
@@ -51,4 +45,4 @@ DenseReplaceTypeFunction::create_compact(const eval::ValueType &result_type,
}
}
-} // namespace vespalib::tensor
+} // namespace vespalib::eval
diff --git a/eval/src/vespa/eval/instruction/dense_replace_type_function.h b/eval/src/vespa/eval/instruction/dense_replace_type_function.h
index f72dcb6bd23..78ce163aceb 100644
--- a/eval/src/vespa/eval/instruction/dense_replace_type_function.h
+++ b/eval/src/vespa/eval/instruction/dense_replace_type_function.h
@@ -4,24 +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/instruction/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/instruction/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/instruction/dense_simple_join_function.h b/eval/src/vespa/eval/instruction/dense_simple_join_function.h
index 48eb73fe09a..8fa0be9d021 100644
--- a/eval/src/vespa/eval/instruction/dense_simple_join_function.h
+++ b/eval/src/vespa/eval/instruction/dense_simple_join_function.h
@@ -5,25 +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,
@@ -34,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/instruction/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/instruction/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
index f179b36ebc6..40432f35c58 100644
--- a/eval/src/vespa/eval/instruction/dense_simple_map_function.h
+++ b/eval/src/vespa/eval/instruction/dense_simple_map_function.h
@@ -4,23 +4,23 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+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 eval::tensor_function::Map
+class DenseSimpleMapFunction : public tensor_function::Map
{
public:
- using map_fun_t = vespalib::eval::operation::op1_t;
- DenseSimpleMapFunction(const eval::ValueType &result_type,
+ 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(); }
- 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/instruction/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/instruction/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/instruction/dense_single_reduce_function.h b/eval/src/vespa/eval/instruction/dense_single_reduce_function.h
index 33027ebc930..ed68bd48c15 100644
--- a/eval/src/vespa/eval/instruction/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);
/**
@@ -33,25 +33,25 @@ make_dense_single_reduce_list(const eval::ValueType &type, eval::Aggr aggr,
* 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/instruction/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/instruction/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
index 7ca906ae38b..9af912ba788 100644
--- a/eval/src/vespa/eval/instruction/dense_tensor_create_function.h
+++ b/eval/src/vespa/eval/instruction/dense_tensor_create_function.h
@@ -4,31 +4,31 @@
#include <vespa/eval/eval/tensor_function.h>
-namespace vespalib::tensor {
+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 eval::TensorFunction
+class DenseTensorCreateFunction : public TensorFunction
{
public:
struct Self {
- eval::ValueType result_type;
+ ValueType result_type;
size_t result_size;
- Self(const eval::ValueType &r, size_t n) : result_type(r), result_size(n) {}
+ Self(const 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 ValueType &res_type, std::vector<Child> children);
~DenseTensorCreateFunction();
- const eval::ValueType &result_type() const override { return _self.result_type; }
+ const 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;
+ 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/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/instruction/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/instruction/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/instruction/vector_from_doubles_function.h b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h
index 739c8721a47..c22ea99f41a 100644
--- a/eval/src/vespa/eval/instruction/vector_from_doubles_function.h
+++ b/eval/src/vespa/eval/instruction/vector_from_doubles_function.h
@@ -4,37 +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: