41 template < typename T1, typename T2, typename std::enable_if < std::is_integral<T1>::value &&!std::is_same<T1, T2>::value,
int >
::type >
50 #pragma omp parallel for 52 for(
int i = 0; i <
src.num_elements(); ++i)
54 result[i] =
src[i] << shift;
61 #pragma omp parallel for 63 for(
int i = 0; i <
src.num_elements(); ++i)
65 T1 val =
src[i] >> shift;
72 template < typename T1, typename T2, typename std::enable_if < is_floating_point<T1>::value &&(!std::is_same<T1, T2>::value &&!std::is_same<T2, bfloat16>::value),
int >::
type >
82 for(
int i = 0; i <
src.num_elements(); ++i)
85 result[i] = utils::cast::saturate_cast<T2>(val);
90 for(
int i = 0; i <
src.num_elements(); ++i)
92 result[i] = static_cast<T2>(
src[i]);
98 template < typename T1, typename T2, typename std::enable_if < std::is_same<T1, bfloat16>::value || std::is_same<T2, bfloat16>::value,
int >
::type >
101 SimpleTensor<T2> result(
src.shape(), dt_out);
105 for(
int i = 0; i <
src.num_elements(); ++i)
107 result[i] = static_cast<T2>(
src[i]);
size_t element_size_from_data_type(DataType dt)
The size in bytes of the data type.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
T round_half_away_from_zero(T value)
Round floating-point value with half value rounding away from zero.
decltype(strategy::transforms) typedef type
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
SimpleTensor< T2 > depth_convert(const SimpleTensor< T1 > &src, DataType dt_out, ConvertPolicy policy, uint32_t shift)
Simple tensor object that stores elements in a consecutive chunk of memory.
DataType
Available data types.
ConvertPolicy
Policy to handle overflow.