37 template <
typename T1,
typename T2>
42 library->fill_tensor_uniform(
dst, 1, static_cast<T2>(0), static_cast<T2>(std::numeric_limits<T1>::max()));
46 #pragma omp parallel for 50 intermediate_type val =
static_cast<intermediate_type
>(src[i]) + static_cast<intermediate_type>(
dst[i]);
57 template <
typename T1,
typename T2>
60 ARM_COMPUTE_ERROR_ON_MSG(alpha < 0.f || alpha > 1.f,
"Weight (alpha) specified in accumulate_weighted must be within the range [0, 1]");
64 library->fill_tensor_uniform(
dst, 1, static_cast<T2>(0), static_cast<T2>(std::numeric_limits<T1>::max()));
68 #pragma omp parallel for 72 double val = (1. -
static_cast<double>(alpha)) *
static_cast<intermediate_type
>(
dst[i]) + static_cast<double>(alpha) *
static_cast<intermediate_type
>(src[i]);
73 dst[i] =
static_cast<T2
>(val);
79 template <
typename T1,
typename T2>
86 library->fill_tensor_uniform(
dst, 1, static_cast<T2>(0), static_cast<T2>(std::numeric_limits<T1>::max()));
89 intermediate_type denom = 1 << shift;
91 #pragma omp parallel for 95 intermediate_type val =
static_cast<intermediate_type
>(
dst[i]) + (static_cast<intermediate_type>(src[i]) *
static_cast<intermediate_type
>(src[i]) / denom);
SimpleTensor< T2 > accumulate_squared(const SimpleTensor< T1 > &src, uint32_t shift, DataType output_data_type)
TensorShape shape() const override
Shape of the tensor.
SimpleTensor< T2 > accumulate(const SimpleTensor< T1 > &src, DataType output_data_type)
SimpleTensor< float > src
Copyright (c) 2017-2022 Arm Limited.
std::unique_ptr< AssetsLibrary > library
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Simple tensor object that stores elements in a consecutive chunk of memory.
T saturate_cast(T val)
Saturate a value of type T against the numeric limits of type U.
int num_elements() const override
Number of elements of the tensor.
SimpleTensor< T2 > accumulate_weighted(const SimpleTensor< T1 > &src, float alpha, DataType output_data_type)
DataType
Available data types.