diff options
Diffstat (limited to 'eval/src/tests/instruction')
28 files changed, 150 insertions, 150 deletions
diff --git a/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp b/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp index d2dccfde2fd..3ad6b3ef5dc 100644 --- a/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp +++ b/eval/src/tests/instruction/add_trivial_dimension_optimizer/add_trivial_dimension_optimizer_test.cpp @@ -20,11 +20,11 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("x5", GenSpec().idx("x", 5).gen()) - .add("x5f", GenSpec().idx("x", 5).cells_float().gen()) - .add("x5y1", GenSpec().idx("x", 5).idx("y", 1).gen()) - .add("y1z1", GenSpec().idx("y", 5).idx("z", 1).gen()) - .add("x_m", GenSpec().map("x", {"a"}).gen()); + .add("x5", GenSpec().idx("x", 5)) + .add("x5f", GenSpec().idx("x", 5).cells_float()) + .add("x5y1", GenSpec().idx("x", 5).idx("y", 1)) + .add("y1z1", GenSpec().idx("y", 5).idx("z", 1)) + .add("x_m", GenSpec().map("x", {"a"})); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp b/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp index 5121c587d5b..1b913e41e94 100644 --- a/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/dense_dot_product_function/dense_dot_product_function_test.cpp @@ -19,7 +19,7 @@ using namespace vespalib::eval::test; const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); TensorSpec makeTensor(size_t numCells, double cellBias) { - return GenSpec().idx("x", numCells).seq_bias(cellBias).gen(); + return GenSpec(cellBias).idx("x", numCells); } const double leftBias = 3.0; @@ -39,7 +39,7 @@ void check_gen_with_result(size_t l, size_t r, double wanted) { param_repo.add("b", makeTensor(r, rightBias)); vespalib::string expr = "reduce(a*b,sum,x)"; EvalFixture evaluator(prod_factory, expr, param_repo, true); - EXPECT_EQUAL(GenSpec().seq_bias(wanted).gen(), evaluator.result()); + EXPECT_EQUAL(GenSpec(wanted), evaluator.result()); EXPECT_EQUAL(evaluator.result(), EvalFixture::ref(expr, param_repo)); auto info = evaluator.find_all<DenseDotProductFunction>(); EXPECT_EQUAL(info.size(), 1u); @@ -87,16 +87,16 @@ TEST("require that dot product with equal sizes is correct") { EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("v01_x1", GenSpec().idx("x", 1).seq_bias(2.0).gen()) - .add("v02_x3", GenSpec().idx("x", 3).seq_bias(4.0).gen()) - .add("v03_x3", GenSpec().idx("x", 3).seq_bias(5.0).gen()) - .add("v04_y3", GenSpec().idx("y", 3).seq_bias(10).gen()) - .add("v05_x5", GenSpec().idx("x", 5).seq_bias(6.0).gen()) - .add("v06_x5", GenSpec().idx("x", 5).seq_bias(7.0).gen()) - .add("v07_x5f", GenSpec().cells_float().idx("x", 5).seq_bias(7.0).gen()) - .add("v08_x5f", GenSpec().cells_float().idx("x", 5).seq_bias(6.0).gen()) - .add("m01_x3y3", GenSpec().idx("x", 3).idx("y", 3).seq_bias(1.0).gen()) - .add("m02_x3y3", GenSpec().idx("x", 3).idx("y", 3).seq_bias(2.0).gen()); + .add("v01_x1", GenSpec(2.0).idx("x", 1)) + .add("v02_x3", GenSpec(4.0).idx("x", 3)) + .add("v03_x3", GenSpec(5.0).idx("x", 3)) + .add("v04_y3", GenSpec(10).idx("y", 3)) + .add("v05_x5", GenSpec(6.0).idx("x", 5)) + .add("v06_x5", GenSpec(7.0).idx("x", 5)) + .add("v07_x5f", GenSpec(7.0).cells_float().idx("x", 5)) + .add("v08_x5f", GenSpec(6.0).cells_float().idx("x", 5)) + .add("m01_x3y3", GenSpec(1.0).idx("x", 3).idx("y", 3)) + .add("m02_x3y3", GenSpec(2.0).idx("x", 3).idx("y", 3)); } EvalFixture::ParamRepo param_repo = make_params(); 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 a1fea41858c..07e995d091f 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 @@ -23,21 +23,21 @@ GenSpec::seq_t glb = [] (size_t) noexcept { EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("con_x5_A", GenSpec().idx("x", 5).seq(glb).gen()) - .add("con_x5_B", GenSpec().idx("x", 5).seq(glb).gen()) - .add("con_x5_C", GenSpec().idx("x", 5).seq(glb).gen()) - .add("con_x5y3_A", GenSpec().idx("x", 5).idx("y", 3).seq(glb).gen()) - .add("con_x5y3_B", GenSpec().idx("x", 5).idx("y", 3).seq(glb).gen()) - .add_mutable("mut_dbl_A", GenSpec().seq_bias(1.5).gen()) - .add_mutable("mut_dbl_B", GenSpec().seq_bias(2.5).gen()) - .add_mutable("mut_x5_A", GenSpec().idx("x", 5).seq(glb).gen()) - .add_mutable("mut_x5_B", GenSpec().idx("x", 5).seq(glb).gen()) - .add_mutable("mut_x5_C", GenSpec().idx("x", 5).seq(glb).gen()) - .add_mutable("mut_x5f_D", GenSpec().cells_float().idx("x", 5).seq(glb).gen()) - .add_mutable("mut_x5f_E", GenSpec().cells_float().idx("x", 5).seq(glb).gen()) - .add_mutable("mut_x5y3_A", GenSpec().idx("x", 5).idx("y", 3).seq(glb).gen()) - .add_mutable("mut_x5y3_B", GenSpec().idx("x", 5).idx("y", 3).seq(glb).gen()) - .add_mutable("mut_x_sparse", GenSpec().map("x", {"a", "b", "c"}).seq(glb).gen()); + .add("con_x5_A", GenSpec().idx("x", 5).seq(glb)) + .add("con_x5_B", GenSpec().idx("x", 5).seq(glb)) + .add("con_x5_C", GenSpec().idx("x", 5).seq(glb)) + .add("con_x5y3_A", GenSpec().idx("x", 5).idx("y", 3).seq(glb)) + .add("con_x5y3_B", GenSpec().idx("x", 5).idx("y", 3).seq(glb)) + .add_mutable("mut_dbl_A", GenSpec(1.5)) + .add_mutable("mut_dbl_B", GenSpec(2.5)) + .add_mutable("mut_x5_A", GenSpec().idx("x", 5).seq(glb)) + .add_mutable("mut_x5_B", GenSpec().idx("x", 5).seq(glb)) + .add_mutable("mut_x5_C", GenSpec().idx("x", 5).seq(glb)) + .add_mutable("mut_x5f_D", GenSpec().cells_float().idx("x", 5).seq(glb)) + .add_mutable("mut_x5f_E", GenSpec().cells_float().idx("x", 5).seq(glb)) + .add_mutable("mut_x5y3_A", GenSpec().idx("x", 5).idx("y", 3).seq(glb)) + .add_mutable("mut_x5y3_B", GenSpec().idx("x", 5).idx("y", 3).seq(glb)) + .add_mutable("mut_x_sparse", GenSpec().map("x", {"a", "b", "c"}).seq(glb)); } EvalFixture::ParamRepo param_repo = make_params(); 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 5dcdbc5bab8..00af70d9136 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 @@ -33,7 +33,7 @@ struct Fixture { std::vector<TensorFunction::Child::CREF> children; InterpretedFunction::State state; Fixture() - : my_value(value_from_spec(GenSpec().idx("x", 10).gen(), prod_factory)), + : my_value(value_from_spec(GenSpec().idx("x", 10), prod_factory)), new_type(ValueType::from_spec("tensor(x[5],y[2])")), mock_child(my_value->type()), my_fun(new_type, mock_child), diff --git a/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp b/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp index 132f88076f6..e8f68e5021e 100644 --- a/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp +++ b/eval/src/tests/instruction/dense_simple_expand_function/dense_simple_expand_function_test.cpp @@ -18,9 +18,9 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.5).gen()) - .add("sparse", GenSpec().map("x", {"a"}).gen()) - .add("mixed", GenSpec().map("y", {"a"}).idx("z", 5).gen()) + .add("a", GenSpec(1.5)) + .add("sparse", GenSpec().map("x", {"a"})) + .add("mixed", GenSpec().map("y", {"a"}).idx("z", 5)) .add_variants("a5", GenSpec().idx("a", 5)) .add_variants("b3", GenSpec().idx("b", 3)) .add_variants("A1a5c1", GenSpec().idx("A", 1).idx("a", 5).idx("c", 1)) 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 2d7b32359bc..a2733b1f7cb 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 @@ -26,8 +26,8 @@ EvalFixture::ParamRepo make_params() { .add_variants("a1b1c2", GenSpec().idx("a", 1).idx("b", 1).idx("c", 2)) .add_variants("a1b1c1", GenSpec().idx("a", 1).idx("b", 1).idx("c", 1)) .add_variants("a10", GenSpec().idx("a", 10)) - .add("xy_mapped", GenSpec().map("x", {"a", "b"}).map("y", {"x", "y"}).gen()) - .add("xyz_mixed", GenSpec().map("x", {"a", "b"}).map("y", {"x", "y"}).idx("z", 3).gen()); + .add("xy_mapped", GenSpec().map("x", {"a", "b"}).map("y", {"x", "y"})) + .add("xyz_mixed", GenSpec().map("x", {"a", "b"}).map("y", {"x", "y"}).idx("z", 3)); } EvalFixture::ParamRepo param_repo = make_params(); 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 15a677c738d..3ab701e58a6 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 @@ -18,9 +18,9 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.0).gen()) - .add("b", GenSpec().seq_bias(2.0).gen()) - .add("c", GenSpec().seq_bias(3.0).gen()); + .add("a", GenSpec(1.0)) + .add("b", GenSpec(2.0)) + .add("c", GenSpec(3.0)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp index 3662aa6243a..782666ed36e 100644 --- a/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp +++ b/eval/src/tests/instruction/dense_tensor_peek_function/dense_tensor_peek_function_test.cpp @@ -18,15 +18,15 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.0).gen()) - .add("b", GenSpec().seq_bias(2.0).gen()) - .add("c", GenSpec().seq_bias(3.0).gen()) - .add("x3", GenSpec().idx("x", 3).gen()) - .add("x3f", GenSpec().cells_float().idx("x", 3).gen()) - .add("x3y2", GenSpec().idx("x", 3).idx("y", 2).gen()) - .add("x3y2f", GenSpec().cells_float().idx("x", 3).idx("y", 2).gen()) - .add("xm", GenSpec().map("x", {"1","2","3","-1","-2","-3"}).gen()) - .add("xmy2", GenSpec().map("x", {"1","2","3"}).idx("y", 2).gen()); + .add("a", GenSpec(1.0)) + .add("b", GenSpec(2.0)) + .add("c", GenSpec(3.0)) + .add("x3", GenSpec().idx("x", 3)) + .add("x3f", GenSpec().cells_float().idx("x", 3)) + .add("x3y2", GenSpec().idx("x", 3).idx("y", 2)) + .add("x3y2f", GenSpec().cells_float().idx("x", 3).idx("y", 2)) + .add("xm", GenSpec().map("x", {"1","2","3","-1","-2","-3"})) + .add("xmy2", GenSpec().map("x", {"1","2","3"}).idx("y", 2)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp b/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp index 35f6b7b1eb8..f4fce7cb5f5 100644 --- a/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp +++ b/eval/src/tests/instruction/dense_xw_product_function/dense_xw_product_function_test.cpp @@ -30,15 +30,15 @@ GenSpec::seq_t my_mat_seq = [] (size_t i) noexcept { return (5.0 + i) * 43.0; }; void add_vector(EvalFixture::ParamRepo &repo, const char *d1, size_t s1) { auto name = make_string("%s%zu", d1, s1); auto layout = GenSpec().idx(d1, s1).seq(my_vec_seq); - repo.add(name, layout.gen()); - repo.add(name + "f", layout.cells_float().gen()); + repo.add(name, layout); + repo.add(name + "f", layout.cells_float()); } void add_matrix(EvalFixture::ParamRepo &repo, const char *d1, size_t s1, const char *d2, size_t s2) { auto name = make_string("%s%zu%s%zu", d1, s1, d2, s2); auto layout = GenSpec().idx(d1, s1).idx(d2, s2).seq(my_mat_seq); - repo.add(name, layout.gen()); - repo.add(name + "f", layout.cells_float().gen()); + repo.add(name, layout); + repo.add(name + "f", layout.cells_float()); } EvalFixture::ParamRepo make_params() { diff --git a/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp b/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp index e915a396ae7..3bc1472f2d5 100644 --- a/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp +++ b/eval/src/tests/instruction/fast_rename_optimizer/fast_rename_optimizer_test.cpp @@ -19,13 +19,13 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("x5", GenSpec().idx("x", 5).gen()) - .add("x5f", GenSpec().idx("x", 5).cells_float().gen()) - .add("x_m", GenSpec().map("x", {"a", "b", "c"}).gen()) - .add("xy_mm", GenSpec().map("x", {"a", "b", "c"}).map("y", {"d","e"}).gen()) - .add("x5y3z_m", GenSpec().idx("x", 5).idx("y", 3).map("z", {"a","b"}).gen()) - .add("x5yz_m", GenSpec().idx("x", 5).map("y", {"a","b"}).map("z", {"d","e"}).gen()) - .add("x5y3", GenSpec().idx("x", 5).idx("y", 3).gen()); + .add("x5", GenSpec().idx("x", 5)) + .add("x5f", GenSpec().idx("x", 5).cells_float()) + .add("x_m", GenSpec().map("x", {"a", "b", "c"})) + .add("xy_mm", GenSpec().map("x", {"a", "b", "c"}).map("y", {"d","e"})) + .add("x5y3z_m", GenSpec().idx("x", 5).idx("y", 3).map("z", {"a","b"})) + .add("x5yz_m", GenSpec().idx("x", 5).map("y", {"a","b"}).map("z", {"d","e"})) + .add("x5y3", GenSpec().idx("x", 5).idx("y", 3)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp b/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp index 17e012b8e33..637a1633f0f 100644 --- a/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp +++ b/eval/src/tests/instruction/generic_concat/generic_concat_test.cpp @@ -78,11 +78,11 @@ void test_generic_concat_with(const ValueBuilderFactory &factory) { for (size_t i = 0; i < concat_layouts.size(); i += 2) { const auto l = concat_layouts[i]; const auto r = concat_layouts[i+1].cpy().seq(N_16ths); - for (TensorSpec lhs : { l.cpy().cells_float().gen(), - l.cpy().cells_double().gen() }) + for (TensorSpec lhs : { l.cpy().cells_float(), + l.cpy().cells_double() }) { - for (TensorSpec rhs : { r.cpy().cells_float().gen(), - r.cpy().cells_double().gen() }) + for (TensorSpec rhs : { r.cpy().cells_float(), + r.cpy().cells_double() }) { SCOPED_TRACE(fmt("\n===\nin LHS: %s\nin RHS: %s\n===\n", lhs.to_string().c_str(), rhs.to_string().c_str())); auto actual = perform_generic_concat(lhs, rhs, "y", factory); diff --git a/eval/src/tests/instruction/generic_create/generic_create_test.cpp b/eval/src/tests/instruction/generic_create/generic_create_test.cpp index fcf4618d592..3677159b64e 100644 --- a/eval/src/tests/instruction/generic_create/generic_create_test.cpp +++ b/eval/src/tests/instruction/generic_create/generic_create_test.cpp @@ -91,8 +91,8 @@ TensorSpec perform_generic_create(const TensorSpec &a, const ValueBuilderFactory void test_generic_create_with(const ValueBuilderFactory &factory) { for (const auto &layout : create_layouts) { - for (TensorSpec full : { layout.cpy().cells_float().gen(), - layout.cpy().cells_double().gen() }) + for (TensorSpec full : { layout.cpy().cells_float(), + layout.cpy().cells_double() }) { auto actual = perform_generic_create(full, factory); auto expect = reference_create(full).normalize(); diff --git a/eval/src/tests/instruction/generic_join/generic_join_test.cpp b/eval/src/tests/instruction/generic_join/generic_join_test.cpp index f724cdf1024..994e67934e7 100644 --- a/eval/src/tests/instruction/generic_join/generic_join_test.cpp +++ b/eval/src/tests/instruction/generic_join/generic_join_test.cpp @@ -107,11 +107,11 @@ TEST(GenericJoinTest, generic_join_works_for_simple_and_fast_values) { for (size_t i = 0; i < join_layouts.size(); i += 2) { const auto &l = join_layouts[i]; const auto &r = join_layouts[i+1]; - for (TensorSpec lhs : { l.cpy().cells_float().gen(), - l.cpy().cells_double().gen() }) + for (TensorSpec lhs : { l.cpy().cells_float(), + l.cpy().cells_double() }) { - for (TensorSpec rhs : { r.cpy().cells_float().gen(), - r.cpy().cells_double().gen() }) + for (TensorSpec rhs : { r.cpy().cells_float(), + r.cpy().cells_double() }) { for (auto fun: {operation::Add::f, operation::Sub::f, operation::Mul::f, operation::Div::f}) { SCOPED_TRACE(fmt("\n===\nLHS: %s\nRHS: %s\n===\n", lhs.to_string().c_str(), rhs.to_string().c_str())); diff --git a/eval/src/tests/instruction/generic_map/generic_map_test.cpp b/eval/src/tests/instruction/generic_map/generic_map_test.cpp index 8e39fa68072..9f30efe135e 100644 --- a/eval/src/tests/instruction/generic_map/generic_map_test.cpp +++ b/eval/src/tests/instruction/generic_map/generic_map_test.cpp @@ -43,8 +43,8 @@ TensorSpec perform_generic_map(const TensorSpec &a, map_fun_t func, const ValueB void test_generic_map_with(const ValueBuilderFactory &factory) { for (const auto &layout : map_layouts) { - for (TensorSpec lhs : { layout.cpy().cells_float().gen(), - layout.cpy().cells_double().gen() }) + for (TensorSpec lhs : { layout.cpy().cells_float(), + layout.cpy().cells_double() }) { for (auto func : {operation::Floor::f, operation::Fabs::f, operation::Square::f, operation::Inv::f}) { SCOPED_TRACE(fmt("\n===\nLHS: %s\n===\n", lhs.to_string().c_str())); diff --git a/eval/src/tests/instruction/generic_merge/generic_merge_test.cpp b/eval/src/tests/instruction/generic_merge/generic_merge_test.cpp index d5f7bc071f6..bb14d869440 100644 --- a/eval/src/tests/instruction/generic_merge/generic_merge_test.cpp +++ b/eval/src/tests/instruction/generic_merge/generic_merge_test.cpp @@ -50,11 +50,11 @@ void test_generic_merge_with(const ValueBuilderFactory &factory) { for (size_t i = 0; i < merge_layouts.size(); i += 2) { const auto l = merge_layouts[i]; const auto r = merge_layouts[i+1].cpy().seq(N_16ths); - for (TensorSpec lhs : { l.cpy().cells_float().gen(), - l.cpy().cells_double().gen() }) + for (TensorSpec lhs : { l.cpy().cells_float(), + l.cpy().cells_double() }) { - for (TensorSpec rhs : { r.cpy().cells_float().gen(), - r.cpy().cells_double().gen() }) + for (TensorSpec rhs : { r.cpy().cells_float(), + r.cpy().cells_double() }) { SCOPED_TRACE(fmt("\n===\nLHS: %s\nRHS: %s\n===\n", lhs.to_string().c_str(), rhs.to_string().c_str())); for (auto fun: {operation::Add::f, operation::Mul::f, operation::Sub::f, operation::Max::f}) { diff --git a/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp b/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp index c80e8a1296b..cafaf5837ec 100644 --- a/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp +++ b/eval/src/tests/instruction/generic_peek/generic_peek_test.cpp @@ -194,8 +194,8 @@ void fill_dims_and_check(const TensorSpec &input, void test_generic_peek_with(const ValueBuilderFactory &factory) { for (const auto &layout : peek_layouts) { - for (TensorSpec input : { layout.cpy().cells_float().gen(), - layout.cpy().cells_double().gen() }) + for (TensorSpec input : { layout.cpy().cells_float(), + layout.cpy().cells_double() }) { ValueType input_type = ValueType::from_spec(input.type()); const auto &dims = input_type.dimensions(); diff --git a/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp b/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp index 2c5baf234c4..4e4cc5fb50b 100644 --- a/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp +++ b/eval/src/tests/instruction/generic_reduce/generic_reduce_test.cpp @@ -70,8 +70,8 @@ TEST(GenericReduceTest, sparse_reduce_plan_can_be_created) { void test_generic_reduce_with(const ValueBuilderFactory &factory) { for (const auto &layout: layouts) { - for (TensorSpec input : { layout.cpy().cells_float().gen(), - layout.cpy().cells_double().gen() }) + for (TensorSpec input : { layout.cpy().cells_float(), + layout.cpy().cells_double() }) { SCOPED_TRACE(fmt("tensor type: %s, num_cells: %zu", input.type().c_str(), input.cells().size())); for (Aggr aggr: {Aggr::SUM, Aggr::AVG, Aggr::MIN, Aggr::MAX}) { diff --git a/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp b/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp index f0c2241202e..dedb22f2763 100644 --- a/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp +++ b/eval/src/tests/instruction/generic_rename/generic_rename_test.cpp @@ -110,8 +110,8 @@ TensorSpec perform_generic_rename(const TensorSpec &a, void test_generic_rename_with(const ValueBuilderFactory &factory) { for (const auto &layout : rename_layouts) { - for (TensorSpec lhs : { layout.cpy().cells_float().gen(), - layout.cpy().cells_double().gen() }) + for (TensorSpec lhs : { layout.cpy().cells_float(), + layout.cpy().cells_double() }) { ValueType lhs_type = ValueType::from_spec(lhs.type()); for (const auto & from_to : rename_from_to) { diff --git a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp index e6a256a493b..6c8afbca681 100644 --- a/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp +++ b/eval/src/tests/instruction/join_with_number/join_with_number_function_test.cpp @@ -35,9 +35,9 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { auto repo = EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.5).gen()) - .add("number", GenSpec().seq_bias(2.5).gen()) - .add("dense", GenSpec().idx("y", 5).gen()) + .add("a", GenSpec(1.5)) + .add("number", GenSpec(2.5)) + .add("dense", GenSpec().idx("y", 5)) .add_variants("x3y5", GenSpec().idx("x", 3).idx("y", 5)) .add_variants("mixed", GenSpec().map("x", {"a"}).idx("y", 5).map("z", {"d","e"})) .add_variants("sparse", GenSpec().map("x", {"a","b","c"}).map("z", {"d","e","f"})); diff --git a/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp b/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp index 6b549b4d4d4..11e7c41fad2 100644 --- a/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp +++ b/eval/src/tests/instruction/mixed_inner_product_function/mixed_inner_product_function_test.cpp @@ -27,20 +27,20 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add_variants("x3", GenSpec().idx("x", 3).seq_bias(2.0)) - .add_variants("x3$2", GenSpec().idx("x", 3).seq_bias(13.25)) - .add_variants("y3", GenSpec().idx("y", 3).seq_bias(4.0)) - .add_variants("z3", GenSpec().idx("z", 3).seq_bias(0.25)) - .add_variants("x3y3", GenSpec().idx("x", 3).idx("y", 3).seq_bias(5.0)) - .add_variants("x1y3", GenSpec().idx("x", 1).idx("y", 3).seq_bias(6.0)) - .add_variants("x3y1", GenSpec().idx("x", 3).idx("y", 1).seq_bias(1.5)) - .add_variants("x3z3", GenSpec().idx("x", 3).idx("z", 3).seq_bias(2.5)) - .add_variants("x3y3z3", GenSpec().idx("x", 3).idx("y", 3).idx("z", 3).seq_bias(-4.0)) - .add("mix_x3zm", GenSpec().idx("x", 3).map("z", {"c","d"}).seq_bias(0.5).gen()) - .add("mix_y3zm", GenSpec().idx("y", 3).map("z", {"c","d"}).seq_bias(3.5).gen()) - .add("mix_x3zm_f", GenSpec().idx("x", 3).map("z", {"c","d"}).cells_float().seq_bias(0.5).gen()) - .add("mix_y3zm_f", GenSpec().idx("y", 3).map("z", {"c","d"}).cells_float().seq_bias(3.5).gen()) - .add("mix_x3y3zm", GenSpec().idx("x", 3).idx("y", 3).map("z", {"c","d"}).seq_bias(0.0).gen()) + .add_variants("x3", GenSpec(2.0).idx("x", 3)) + .add_variants("x3$2", GenSpec(13.25).idx("x", 3)) + .add_variants("y3", GenSpec(4.0).idx("y", 3)) + .add_variants("z3", GenSpec(0.25).idx("z", 3)) + .add_variants("x3y3", GenSpec(5.0).idx("x", 3).idx("y", 3)) + .add_variants("x1y3", GenSpec(6.0).idx("x", 1).idx("y", 3)) + .add_variants("x3y1", GenSpec(1.5).idx("x", 3).idx("y", 1)) + .add_variants("x3z3", GenSpec(2.5).idx("x", 3).idx("z", 3)) + .add_variants("x3y3z3", GenSpec(-4.0).idx("x", 3).idx("y", 3).idx("z", 3)) + .add("mix_x3zm", GenSpec(0.5).idx("x", 3).map("z", {"c","d"})) + .add("mix_y3zm", GenSpec(3.5).idx("y", 3).map("z", {"c","d"})) + .add("mix_x3zm_f", GenSpec(0.5).idx("x", 3).map("z", {"c","d"}).cells_float()) + .add("mix_y3zm_f", GenSpec(3.5).idx("y", 3).map("z", {"c","d"}).cells_float()) + .add("mix_x3y3zm", GenSpec(0.0).idx("x", 3).idx("y", 3).map("z", {"c","d"})) ; } diff --git a/eval/src/tests/instruction/mixed_map_function/mixed_map_function_test.cpp b/eval/src/tests/instruction/mixed_map_function/mixed_map_function_test.cpp index 3a7d1368f03..dae147da216 100644 --- a/eval/src/tests/instruction/mixed_map_function/mixed_map_function_test.cpp +++ b/eval/src/tests/instruction/mixed_map_function/mixed_map_function_test.cpp @@ -15,8 +15,8 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.5).gen()) - .add("b", GenSpec().seq_bias(2.5).gen()) + .add("a", GenSpec(1.5)) + .add("b", GenSpec(2.5)) .add_variants("sparse", GenSpec().map("x", {"a"})) .add_variants("mixed", GenSpec().map("x", {"a"}).idx("y", 5)) .add_variants("x5y3", GenSpec().idx("x", 5).idx("y", 3)); diff --git a/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp b/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp index 105ae22e06e..6220682d716 100644 --- a/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp +++ b/eval/src/tests/instruction/mixed_simple_join_function/mixed_simple_join_function_test.cpp @@ -45,12 +45,12 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.5).gen()) - .add("b", GenSpec().seq_bias(2.5).gen()) - .add("sparse", GenSpec().map("x", {"a", "b", "c"}).gen()) - .add("mixed", GenSpec().map("x", {"a", "b", "c"}).idx("y", 5).idx("z", 3).gen()) - .add("empty_mixed", GenSpec().map("x", {}).idx("y", 5).idx("z", 3).gen()) - .add_mutable("@mixed", GenSpec().map("x", {"a", "b", "c"}).idx("y", 5).idx("z", 3).gen()) + .add("a", GenSpec(1.5)) + .add("b", GenSpec(2.5)) + .add("sparse", GenSpec().map("x", {"a", "b", "c"})) + .add("mixed", GenSpec().map("x", {"a", "b", "c"}).idx("y", 5).idx("z", 3)) + .add("empty_mixed", GenSpec().map("x", {}).idx("y", 5).idx("z", 3)) + .add_mutable("@mixed", GenSpec().map("x", {"a", "b", "c"}).idx("y", 5).idx("z", 3)) .add_variants("a1b1c1", GenSpec().idx("a", 1).idx("b", 1).idx("c", 1)) .add_variants("x1y1z1", GenSpec().idx("x", 1).idx("y", 1).idx("z", 1)) .add_variants("x3y5z3", GenSpec().idx("x", 3).idx("y", 5).idx("z", 3)) diff --git a/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp b/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp index fe32a59bb78..029a080197d 100644 --- a/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp +++ b/eval/src/tests/instruction/pow_as_map_optimizer/pow_as_map_optimizer_test.cpp @@ -16,10 +16,10 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.5).gen()) - .add("b", GenSpec().seq_bias(2.5).gen()) - .add("sparse", GenSpec().map("x", {"a","b"}).gen()) - .add("mixed", GenSpec().map("x", {"a"}).idx("y", 5).gen()) + .add("a", GenSpec(1.5)) + .add("b", GenSpec(2.5)) + .add("sparse", GenSpec().map("x", {"a","b"})) + .add("mixed", GenSpec().map("x", {"a"}).idx("y", 5)) .add_variants("x5y3", GenSpec().idx("x", 5).idx("y", 3)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp b/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp index 794725a8257..6439ec305dd 100644 --- a/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp +++ b/eval/src/tests/instruction/remove_trivial_dimension_optimizer/remove_trivial_dimension_optimizer_test.cpp @@ -19,10 +19,10 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("x1y5z1", GenSpec().idx("x", 1).idx("y", 5).idx("z", 1).gen()) - .add("x1y5z1f", GenSpec().idx("x", 1).idx("y", 5).idx("z", 1).cells_float().gen()) - .add("x1y1z1", GenSpec().idx("x", 1).idx("y", 1).idx("z", 1).gen()) - .add("x1y5z_m", GenSpec().idx("x", 1).idx("y", 5).map("z", {"a"}).gen()); + .add("x1y5z1", GenSpec().idx("x", 1).idx("y", 5).idx("z", 1)) + .add("x1y5z1f", GenSpec().idx("x", 1).idx("y", 5).idx("z", 1).cells_float()) + .add("x1y1z1", GenSpec().idx("x", 1).idx("y", 1).idx("z", 1)) + .add("x1y5z_m", GenSpec().idx("x", 1).idx("y", 5).map("z", {"a"})); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp b/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp index ac333f5224a..96f156ccdb9 100644 --- a/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/sparse_dot_product_function/sparse_dot_product_function_test.cpp @@ -17,13 +17,13 @@ const ValueBuilderFactory &test_factory = SimpleValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add_variants("v1_x", GenSpec().map("x", 32, 1).seq_bias(3.0)) - .add_variants("v2_x", GenSpec().map("x", 16, 2).seq_bias(7.0)) - .add("v3_y", GenSpec().map("y", 10, 1).gen()) - .add("v4_xd", GenSpec().idx("x", 10).gen()) - .add("m1_xy", GenSpec().map("x", 32, 1).map("y", 16, 2).seq_bias(3.0).gen()) - .add("m2_xy", GenSpec().map("x", 16, 2).map("y", 32, 1).seq_bias(7.0).gen()) - .add("m3_xym", GenSpec().map("x", 8, 1).idx("y", 5).gen()); + .add_variants("v1_x", GenSpec(3.0).map("x", 32, 1)) + .add_variants("v2_x", GenSpec(7.0).map("x", 16, 2)) + .add("v3_y", GenSpec().map("y", 10, 1)) + .add("v4_xd", GenSpec().idx("x", 10)) + .add("m1_xy", GenSpec(3.0).map("x", 32, 1).map("y", 16, 2)) + .add("m2_xy", GenSpec(7.0).map("x", 16, 2).map("y", 32, 1)) + .add("m3_xym", GenSpec().map("x", 8, 1).idx("y", 5)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp b/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp index e175286e18c..8bd27bd9a03 100644 --- a/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp +++ b/eval/src/tests/instruction/sparse_merge_function/sparse_merge_function_test.cpp @@ -17,15 +17,15 @@ const ValueBuilderFactory &test_factory = SimpleValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("scalar1", GenSpec(1.0).gen()) - .add("scalar2", GenSpec(2.0).gen()) + .add("scalar1", GenSpec(1.0)) + .add("scalar2", GenSpec(2.0)) .add_variants("v1_x", GenSpec(3.0).map("x", 32, 1)) .add_variants("v2_x", GenSpec(4.0).map("x", 16, 2)) .add_variants("v3_xz", GenSpec(5.0).map("x", 16, 2).idx("z", 1)) - .add("dense", GenSpec(6.0).idx("x", 10).gen()) - .add("m1_xy", GenSpec(7.0).map("x", 32, 1).map("y", 16, 2).gen()) - .add("m2_xy", GenSpec(8.0).map("x", 16, 2).map("y", 32, 1).gen()) - .add("mixed", GenSpec(9.0).map("x", 8, 1).idx("y", 5).gen()); + .add("dense", GenSpec(6.0).idx("x", 10)) + .add("m1_xy", GenSpec(7.0).map("x", 32, 1).map("y", 16, 2)) + .add("m2_xy", GenSpec(8.0).map("x", 16, 2).map("y", 32, 1)) + .add("mixed", GenSpec(9.0).map("x", 8, 1).idx("y", 5)); } EvalFixture::ParamRepo param_repo = make_params(); diff --git a/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp b/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp index 1013c98b424..f68c089e784 100644 --- a/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp +++ b/eval/src/tests/instruction/sum_max_dot_product_function/sum_max_dot_product_function_test.cpp @@ -45,9 +45,9 @@ void assert_not_optimized(const TensorSpec &a, const TensorSpec &b, const vespal //----------------------------------------------------------------------------- -GenSpec QueGen(size_t x_size, size_t z_size) { return GenSpec().cells_float().map("x", x_size).idx("z", z_size).seq_bias(0.5); } +GenSpec QueGen(size_t x_size, size_t z_size) { return GenSpec(0.5).cells_float().map("x", x_size).idx("z", z_size); } -GenSpec DocGen(size_t y_size, size_t z_size) { return GenSpec().cells_float().map("y", y_size).idx("z", z_size).seq_bias(2.5); } +GenSpec DocGen(size_t y_size, size_t z_size) { return GenSpec(2.5).cells_float().map("y", y_size).idx("z", z_size); } GenSpec Que() { return QueGen(3, 5); } GenSpec Doc() { return DocGen(6, 5); } @@ -58,10 +58,10 @@ GenSpec DocEmptyX() { return DocGen(0, 5); } GenSpec QueTrivialZ() { return QueGen(3, 1); } GenSpec DocTrivialZ() { return DocGen(6, 1); } -auto query = Que().gen(); -auto document = Doc().gen(); -auto empty_query = QueEmptyX().gen(); -auto empty_document = DocEmptyX().gen(); +auto query = Que(); +auto document = Doc(); +auto empty_query = QueEmptyX(); +auto empty_document = DocEmptyX(); TEST(SumMaxDotProduct, expressions_can_be_optimized) { @@ -73,24 +73,24 @@ TEST(SumMaxDotProduct, expressions_can_be_optimized) } TEST(SumMaxDotProduct, double_cells_are_not_optimized) { - auto double_query = Que().cells_double().gen(); - auto double_document = Doc().cells_double().gen(); + auto double_query = Que().cells_double(); + auto double_document = Doc().cells_double(); assert_not_optimized(query, double_document); assert_not_optimized(double_query, document); assert_not_optimized(double_query, double_document); } TEST(SumMaxDotProduct, trivial_dot_product_is_not_optimized) { - auto trivial_query = QueTrivialZ().gen(); - auto trivial_document = DocTrivialZ().gen(); + auto trivial_query = QueTrivialZ(); + auto trivial_document = DocTrivialZ(); assert_not_optimized(trivial_query, trivial_document); } TEST(SumMaxDotProduct, additional_dimensions_are_not_optimized) { - auto extra_sparse_query = Que().map("a", 1).gen(); - auto extra_dense_query = Que().idx("a", 1).gen(); - auto extra_sparse_document = Doc().map("a", 1).gen(); - auto extra_dense_document = Doc().idx("a", 1).gen(); + auto extra_sparse_query = Que().map("a", 1); + auto extra_dense_query = Que().idx("a", 1); + auto extra_sparse_document = Doc().map("a", 1); + auto extra_dense_document = Doc().idx("a", 1); vespalib::string extra_sum_expr = "reduce(reduce(reduce(a*b,sum,z),max,y),sum,a,x)"; vespalib::string extra_max_expr = "reduce(reduce(reduce(a*b,sum,z),max,a,y),sum,x)"; assert_not_optimized(extra_sparse_query, document); @@ -104,8 +104,8 @@ TEST(SumMaxDotProduct, additional_dimensions_are_not_optimized) { } TEST(SumMaxDotProduct, more_dense_variants_are_not_optimized) { - auto dense_query = GenSpec().cells_float().idx("x", 3).idx("z", 5).seq_bias(0.5).gen(); - auto dense_document = GenSpec().cells_float().idx("y", 5).idx("z", 5).seq_bias(2.5).gen(); + auto dense_query = GenSpec(0.5).cells_float().idx("x", 3).idx("z", 5); + auto dense_document = GenSpec(2.5).cells_float().idx("y", 5).idx("z", 5); assert_not_optimized(dense_query, document); assert_not_optimized(query, dense_document); assert_not_optimized(dense_query, dense_document); 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 2371c1e4006..635296ef78c 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 @@ -18,11 +18,11 @@ const ValueBuilderFactory &prod_factory = FastValueBuilderFactory::get(); EvalFixture::ParamRepo make_params() { return EvalFixture::ParamRepo() - .add("a", GenSpec().seq_bias(1.0).gen()) - .add("b", GenSpec().seq_bias(2.0).gen()) - .add("c", GenSpec().seq_bias(3.0).gen()) - .add("d", GenSpec().seq_bias(4.0).gen()) - .add("x5", GenSpec().idx("x", 5).gen()); + .add("a", GenSpec(1.0)) + .add("b", GenSpec(2.0)) + .add("c", GenSpec(3.0)) + .add("d", GenSpec(4.0)) + .add("x5", GenSpec().idx("x", 5)); } EvalFixture::ParamRepo param_repo = make_params(); |