aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/instruction/sparse_112_dot_product.h
blob: 2344a5eee2dfe51fdfef23624013a556ec456871 (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 Yahoo. 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 two 1d
 * sparse tensors and a 2d sparse tensor.
 */
class Sparse112DotProduct : public tensor_function::Node
{
private:
    Child _a;
    Child _b;
    Child _c;

public:
    Sparse112DotProduct(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