MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / accumulate

Function accumulate

tests/validation/reference/Accumulate.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37{
38template <typename T1, typename T2>
39SimpleTensor<T2> accumulate(const SimpleTensor<T1> &src, DataType output_data_type)
40{
41 SimpleTensor<T2> dst{src.shape(), output_data_type};
42
43 library->fill_tensor_uniform(dst, 1, static_cast<T2>(0), static_cast<T2>(std::numeric_limits<T1>::max()));
44
45 using intermediate_type = typename common_promoted_signed_type<T1, T2>::intermediate_type;
46#if defined(_OPENMP)
47#pragma omp parallel for
48#endif /* _OPENMP */
49 for (int i = 0; i < src.num_elements(); ++i)
50 {
51 intermediate_type val = static_cast<intermediate_type>(src[i]) + static_cast<intermediate_type>(dst[i]);
52 dst[i] = saturate_cast<T2>(val);
53 }
54
55 return dst;
56}
57
58template <typename T1, typename T2>
59SimpleTensor<T2> accumulate_weighted(const SimpleTensor<T1> &src, float alpha, DataType output_data_type)

Callers 12

total_sizeMethod · 0.85
total_size_upperMethod · 0.85
total_size_lowerMethod · 0.85
collapseMethod · 0.85
joinFunction · 0.85
digit_reverse_indicesFunction · 0.85
pixel_area_c1u8_clampFunction · 0.85
sizeMethod · 0.85
joinFunction · 0.85
test_measurementsMethod · 0.85
InstrumentsStatsMethod · 0.85

Calls 3

fill_tensor_uniformMethod · 0.80
shapeMethod · 0.45
num_elementsMethod · 0.45

Tested by 1

test_measurementsMethod · 0.68