39 template <typename T, typename std::enable_if<is_floating_point<T>::value,
int>
::type *>
45 const auto cols = static_cast<int>(
src.shape()[0]);
46 const auto rows = static_cast<int>(
src.shape()[1]);
47 const auto depth = static_cast<int>(
src.shape()[2]);
48 const int upper_dims =
src.shape().total_size() / (
cols *
rows * depth);
50 #pragma omp parallel for schedule(dynamic, 1) collapse(4) 52 for(
int r = 0; r < upper_dims; ++r)
54 for(
int i = 0; i < depth; ++i)
56 for(
int k = 0; k <
rows; ++k)
58 for(
int l = 0; l <
cols; ++l)
61 const float denominator = sqrt(var[i] +
epsilon);
62 const float numerator =
src[pos] - mean[i];
63 const float x_bar = numerator / denominator;
64 result[pos] = beta[i] + x_bar * gamma[i];
SimpleTensor< T > activation_layer(const SimpleTensor< T > &src, ActivationLayerInfo info, const QuantizationInfo &oq_info)
bool enabled() const
Check if initialised.
Activation Layer Information class.
decltype(strategy::transforms) typedef type
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
Simple tensor object that stores elements in a consecutive chunk of memory.
SimpleTensor< T > batch_normalization_layer(const SimpleTensor< T > &src, const SimpleTensor< T > &mean, const SimpleTensor< T > &var, const SimpleTensor< T > &beta, const SimpleTensor< T > &gamma, float epsilon, ActivationLayerInfo act_info)