summaryrefslogtreecommitdiffstats
path: root/eval/src/vespa/eval/tensor/tensor_apply.cpp
blob: 8384d99712279b065261355e923789d3c08ed9b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "tensor_apply.h"

namespace vespalib {
namespace tensor {

template <class TensorT>
TensorApply<TensorT>::TensorApply(const TensorImplType &tensor,
                                  const CellFunction &func)
    : Parent(tensor.type())
{
    for (const auto &cell : tensor.cells()) {
        _builder.insertCell(cell.first, func.apply(cell.second));
    }
}

template class TensorApply<SparseTensor>;

} // namespace vespalib::tensor
} // namespace vespalib