aboutsummaryrefslogtreecommitdiff
path: root/tests/validation_old/TensorOperations.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation_old/TensorOperations.h')
-rw-r--r--tests/validation_old/TensorOperations.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/tests/validation_old/TensorOperations.h b/tests/validation_old/TensorOperations.h
index 0c1ab4134e..04a79f0de3 100644
--- a/tests/validation_old/TensorOperations.h
+++ b/tests/validation_old/TensorOperations.h
@@ -861,70 +861,6 @@ void warp_perspective(const Tensor<T> &in, Tensor<T> &out, Tensor<T> &valid_mask
}
}
-// Batch Normalization Layer for fixed point type
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type * = nullptr>
-void batch_normalization_layer(const Tensor<T> &in, Tensor<T> &out, const Tensor<T> &mean, const Tensor<T> &var, const Tensor<T> &beta, const Tensor<T> &gamma, float epsilon, int fixed_point_position)
-{
- const int cols = static_cast<int>(in.shape()[0]);
- const int rows = static_cast<int>(in.shape()[1]);
- const int depth = static_cast<int>(in.shape()[2]);
- int upper_dims = in.shape().total_size() / (cols * rows * depth);
-
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int i = 0; i < depth; ++i)
- {
- for(int k = 0; k < rows; ++k)
- {
- for(int l = 0; l < cols; ++l)
- {
- const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
- fixed_point_arithmetic::fixed_point<T> in_qs(in[pos], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> var_qs(var[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> mean_qs(mean[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> beta_qs(beta[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> gamma_qs(gamma[i], fixed_point_position, true);
- fixed_point_arithmetic::fixed_point<T> epsilon_qs(epsilon, fixed_point_position);
-
- auto denominator = fixed_point_arithmetic::inv_sqrt(var_qs + epsilon_qs);
- auto numerator = in_qs - mean_qs;
- auto x_bar = numerator * denominator;
- x_bar = beta_qs + x_bar * gamma_qs;
- out[pos] = x_bar.raw();
- }
- }
- }
- }
-}
-
-// Batch Normalization Layer for floating point type
-template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type * = nullptr>
-void batch_normalization_layer(const Tensor<T> &in, Tensor<T> &out, const Tensor<T> &mean, const Tensor<T> &var, const Tensor<T> &beta, const Tensor<T> &gamma, float epsilon, int fixed_point_position)
-{
- const int cols = static_cast<int>(in.shape()[0]);
- const int rows = static_cast<int>(in.shape()[1]);
- const int depth = static_cast<int>(in.shape()[2]);
- int upper_dims = in.shape().total_size() / (cols * rows * depth);
-
- for(int r = 0; r < upper_dims; ++r)
- {
- for(int i = 0; i < depth; ++i)
- {
- for(int k = 0; k < rows; ++k)
- {
- for(int l = 0; l < cols; ++l)
- {
- const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
- const float denominator = sqrt(var[i] + epsilon);
- const float numerator = in[pos] - mean[i];
- const float x_bar = numerator / denominator;
- out[pos] = beta[i] + x_bar * gamma[i];
- }
- }
- }
- }
-}
-
// ROI Pooling layer
template <typename T>
void roi_pooling_layer(const Tensor<T> &in, Tensor<T> &out, const std::vector<ROI> &rois, const ROIPoolingLayerInfo &pool_info)