diff options
author | Håvard Pettersen <havardpe@oath.com> | 2018-01-31 14:47:02 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2018-01-31 14:47:02 +0000 |
commit | 7db5bb4ee89517521d08861b5094e68a6931e585 (patch) | |
tree | 0a966a60526f1948cb28dd60f904317e1c2b1d6f /eval/src | |
parent | 2c25a02adbe644b3f50dc44252c6b61974d0c8d6 (diff) |
remove recursive eval from tensor function
Diffstat (limited to 'eval/src')
-rw-r--r-- | eval/src/vespa/eval/eval/tensor_function.cpp | 57 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/tensor_function.h | 20 |
2 files changed, 0 insertions, 77 deletions
diff --git a/eval/src/vespa/eval/eval/tensor_function.cpp b/eval/src/vespa/eval/eval/tensor_function.cpp index 7405326e2d9..23ab2d225a7 100644 --- a/eval/src/vespa/eval/eval/tensor_function.cpp +++ b/eval/src/vespa/eval/eval/tensor_function.cpp @@ -109,12 +109,6 @@ Op2::push_children(std::vector<Child::CREF> &children) const //----------------------------------------------------------------------------- -const Value & -ConstValue::eval(const TensorEngine &, const LazyParams &, Stash &) const -{ - return _value; -} - Instruction ConstValue::compile_self(Stash &) const { @@ -123,12 +117,6 @@ ConstValue::compile_self(Stash &) const //----------------------------------------------------------------------------- -const Value & -Inject::eval(const TensorEngine &, const LazyParams ¶ms, Stash &stash) const -{ - return params.resolve(_param_idx, stash); -} - Instruction Inject::compile_self(Stash &) const { @@ -137,13 +125,6 @@ Inject::compile_self(Stash &) const //----------------------------------------------------------------------------- -const Value & -Reduce::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - const Value &a = child().eval(engine, params, stash); - return engine.reduce(a, _aggr, _dimensions, stash); -} - Instruction Reduce::compile_self(Stash &stash) const { @@ -153,13 +134,6 @@ Reduce::compile_self(Stash &stash) const //----------------------------------------------------------------------------- -const Value & -Map::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - const Value &a = child().eval(engine, params, stash); - return engine.map(a, _function, stash); -} - Instruction Map::compile_self(Stash &) const { @@ -171,14 +145,6 @@ Map::compile_self(Stash &) const //----------------------------------------------------------------------------- -const Value & -Join::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - const Value &a = lhs().eval(engine, params, stash); - const Value &b = rhs().eval(engine, params, stash); - return engine.join(a, b, _function, stash); -} - Instruction Join::compile_self(Stash &) const { @@ -196,14 +162,6 @@ Join::compile_self(Stash &) const //----------------------------------------------------------------------------- -const Value & -Concat::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - const Value &a = lhs().eval(engine, params, stash); - const Value &b = rhs().eval(engine, params, stash); - return engine.concat(a, b, _dimension, stash); -} - Instruction Concat::compile_self(Stash &) const { @@ -212,13 +170,6 @@ Concat::compile_self(Stash &) const //----------------------------------------------------------------------------- -const Value & -Rename::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - const Value &a = child().eval(engine, params, stash); - return engine.rename(a, _from, _to, stash); -} - Instruction Rename::compile_self(Stash &stash) const { @@ -236,14 +187,6 @@ If::push_children(std::vector<Child::CREF> &children) const children.emplace_back(_false_child); } -const Value & -If::eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const -{ - return (cond().eval(engine, params, stash).as_bool() - ? true_child().eval(engine, params, stash) - : false_child().eval(engine, params, stash)); -} - Instruction If::compile_self(Stash &) const { diff --git a/eval/src/vespa/eval/eval/tensor_function.h b/eval/src/vespa/eval/eval/tensor_function.h index c739ea8cba9..442e082d9d9 100644 --- a/eval/src/vespa/eval/eval/tensor_function.h +++ b/eval/src/vespa/eval/eval/tensor_function.h @@ -87,18 +87,6 @@ struct TensorFunction **/ virtual InterpretedFunction::Instruction compile_self(Stash &stash) const = 0; - /** - * Evaluate this tensor function based on the given - * parameters. The given stash can be used to store temporary - * objects that need to be kept alive for the return value to be - * valid. The return value must conform to 'result_type'. - * - * @return result of evaluating this tensor function - * @param engine the tensor engine we are using for evaluation - * @param params external values needed to evaluate this function - * @param stash heterogeneous object store - **/ - virtual const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const = 0; virtual ~TensorFunction() {} }; @@ -169,7 +157,6 @@ private: const Value &_value; public: ConstValue(const Value &value_in) : Leaf(value_in.type()), _value(value_in) {} - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -183,7 +170,6 @@ public: Inject(const ValueType &result_type_in, size_t param_idx_in) : Leaf(result_type_in), _param_idx(param_idx_in) {} size_t param_idx() const { return _param_idx; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -202,7 +188,6 @@ public: : Op1(result_type_in, child_in), _aggr(aggr_in), _dimensions(dimensions_in) {} Aggr aggr() const { return _aggr; } const std::vector<vespalib::string> &dimensions() const { return _dimensions; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -218,7 +203,6 @@ public: map_fun_t function_in) : Op1(result_type_in, child_in), _function(function_in) {} map_fun_t function() const { return _function; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -235,7 +219,6 @@ public: join_fun_t function_in) : Op2(result_type_in, lhs_in, rhs_in), _function(function_in) {} join_fun_t function() const { return _function; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -252,7 +235,6 @@ public: const vespalib::string &dimension_in) : Op2(result_type_in, lhs_in, rhs_in), _dimension(dimension_in) {} const vespalib::string &dimension() const { return _dimension; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -271,7 +253,6 @@ public: : Op1(result_type_in, child_in), _from(from_in), _to(to_in) {} const std::vector<vespalib::string> &from() const { return _from; } const std::vector<vespalib::string> &to() const { return _to; } - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; @@ -293,7 +274,6 @@ public: const TensorFunction &true_child() const { return _true_child.get(); } const TensorFunction &false_child() const { return _false_child.get(); } void push_children(std::vector<Child::CREF> &children) const final override; - const Value &eval(const TensorEngine &engine, const LazyParams ¶ms, Stash &stash) const final override; InterpretedFunction::Instruction compile_self(Stash &stash) const final override; }; |