aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/instruction/inplace_map_function.h
blob: 172693ab2bf2192973a150de767505a9876550d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/tensor_function.h>

namespace vespalib::eval {

/**
 * Tensor function optimizing in-place map operations on tensors.
 **/
class InplaceMapFunction : public tensor_function::Map
{
public:
    using map_fun_t = operation::op1_t;
    InplaceMapFunction(const ValueType &result_type,
                     const TensorFunction &child,
                     map_fun_t function_in);
    ~InplaceMapFunction() override;
    bool inplace() const { return child().result_is_mutable(); }
    InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
    static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};

} // namespace vespalib::eval