aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/instruction/mixed_112_dot_product.h
blob: d0c3c18b9960fc1141b4a627e36042d26d47438a (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
26
27
28
29
30
31
// 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 for the dot product between (the expansion of a 1d
 * sparse tensor and a 1d dense tensor) and (a 2d mixed tensor).
 */
class Mixed112DotProduct : public tensor_function::Node
{
private:
    Child _a; // 1d sparse
    Child _b; // 1d dense
    Child _c; // 2d mixed

public:
    Mixed112DotProduct(const TensorFunction &a_in,
                       const TensorFunction &b_in,
                       const TensorFunction &c_in);
    InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
    bool result_is_mutable() const override { return true; }
    void push_children(std::vector<Child::CREF> &children) const final override;
    void visit_children(vespalib::ObjectVisitor &visitor) const final override;
    static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};

} // namespace