Coverage Report

Created: 2026-11-02 16:55

/home/runner/work/LabNeura/LabNeura/src/labneura/backends/cpu/generic/generic_ops_fp32.cpp
Line
Count
Source (jump to first uncovered line)
1
#include "labneura/backends/cpu/generic.h"
2
#include <algorithm>
3
4
namespace labneura {
5
6
12
void GenericBackend::operation_fp32(const TensorBackend& other, OperationType op_type) {
7
12
    const float* other_data = other.data_fp32();
8
12
    float* this_data = data_fp32();
9
10
12
    if (op_type == OperationType::ADD) {
11
10.0k
        for (std::size_t i = 0; i < size_; ++i) this_data[i] += other_data[i];
12
6
        return;
13
6
    }
14
6
    if (op_type == OperationType::MUL) {
15
11
        for (std::size_t i = 0; i < size_; ++i) this_data[i] *= other_data[i];
16
3
        return;
17
3
    }
18
3
    if (op_type == OperationType::DIV) {
19
0
        for (std::size_t i = 0; i < size_; ++i) this_data[i] /= other_data[i];
20
0
        return;
21
0
    }
22
11
    for (std::size_t i = 0; i < size_; ++i) this_data[i] -= other_data[i];
23
3
}
24
25
} // namespace labneura