40 template <typename T, typename std::enable_if<std::is_integral<T>::value,
int>::type *>
47 const auto cols =
static_cast<int>(src.
shape()[0]);
48 const auto rows =
static_cast<int>(src.
shape()[1]);
49 const auto depth =
static_cast<int>(src.
shape()[2]);
50 const int upper_dims = src.
shape().total_size() / (cols * rows * depth);
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)
60 const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
70 auto numerator = src_qs - mean_qs;
71 auto x_bar = numerator * denominator;
72 x_bar = beta_qs + x_bar * gamma_qs;
73 result[pos] = x_bar.
raw();
83 template <typename T, typename std::enable_if<is_floating_point<T>::value,
int>::type *>
91 const auto cols =
static_cast<int>(src.
shape()[0]);
92 const auto rows =
static_cast<int>(src.
shape()[1]);
93 const auto depth =
static_cast<int>(src.
shape()[2]);
94 const int upper_dims = src.
shape().total_size() / (cols * rows * depth);
96 for(
int r = 0; r < upper_dims; ++r)
98 for(
int i = 0; i < depth; ++i)
100 for(
int k = 0; k < rows; ++k)
102 for(
int l = 0; l < cols; ++l)
104 const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
105 const float denominator = sqrt(var[i] + epsilon);
106 const float numerator = src[pos] - mean[i];
107 const float x_bar = numerator / denominator;
108 result[pos] = beta[i] + x_bar * gamma[i];
SimpleTensor< T > activation_layer(const SimpleTensor< T > &src, ActivationLayerInfo info)
DataType data_type() const override
Data type of the tensor.
TensorShape shape() const override
Shape of the tensor.
Activation Layer Information class.
This file contains all available output stages for GEMMLowp on OpenCL.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Arbitrary fixed-point arithmetic class.
bool enabled() const
Check if initialised.
T raw() const
Raw value accessor.
fixed_point< T > inv_sqrt(fixed_point< T > x)
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, int fixed_point_position)
Simple tensor object that stores elements in a consecutive chunk of memory.
convolution configure & src