| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "../include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <numeric> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "../../common/include/common.hpp" | ||
| 7 | |||
| 8 | namespace shekhirev_v_custom_reduce_seq { | ||
| 9 | |||
| 10 | 32 | CustomReduceSequential::CustomReduceSequential(const shekhirev_v_custom_reduce::InType &in) { | |
| 11 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 12 | 32 | GetInput() = in; | |
| 13 | GetOutput() = 0; | ||
| 14 | 32 | } | |
| 15 | |||
| 16 | 32 | bool CustomReduceSequential::ValidationImpl() { | |
| 17 | 32 | return GetInput() >= 0; | |
| 18 | } | ||
| 19 | |||
| 20 | 32 | bool CustomReduceSequential::PreProcessingImpl() { | |
| 21 | 32 | GetOutput() = GetInput() + 1; | |
| 22 | 32 | return true; | |
| 23 | } | ||
| 24 | |||
| 25 | 32 | bool CustomReduceSequential::RunImpl() { | |
| 26 | 32 | const std::vector<int> vec(GetInput(), 1); | |
| 27 | const int sum = std::accumulate(vec.begin(), vec.end(), 0); | ||
| 28 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | GetOutput() = sum; |
| 29 | 32 | return true; | |
| 30 | } | ||
| 31 | |||
| 32 | 32 | bool CustomReduceSequential::PostProcessingImpl() { | |
| 33 | 32 | return true; | |
| 34 | } | ||
| 35 | |||
| 36 | } // namespace shekhirev_v_custom_reduce_seq | ||
| 37 |