aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.h
blob: bc4bba993f81a93307fc04741b927dfcfb55f809 (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
32
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "tensor_factory_blueprint.h"

namespace search::features {

/**
 * Blueprint for a rank feature that creates a tensor from an array
 * where the elements in the array are used as labels in the tensor addresses.
 * The tensor cells all get the value 1.0.
 *
 * The array source can be either an attribute vector or query parameter.
 */
class TensorFromLabelsBlueprint : public TensorFactoryBlueprint
{
public:
    TensorFromLabelsBlueprint();
    fef::Blueprint::UP createInstance() const override {
        return Blueprint::UP(new TensorFromLabelsBlueprint());
    }
    fef::ParameterDescriptions getDescriptions() const override {
        return fef::ParameterDescriptions().
            desc().string().
            desc().string().string();
    }
    bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList &params) override;
    fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;
};

}