aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/TensorOperations.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/TensorOperations.h')
-rw-r--r--tests/validation/TensorOperations.h73
1 files changed, 0 insertions, 73 deletions
diff --git a/tests/validation/TensorOperations.h b/tests/validation/TensorOperations.h
index f4d2110387..6e6d1f5115 100644
--- a/tests/validation/TensorOperations.h
+++ b/tests/validation/TensorOperations.h
@@ -592,79 +592,6 @@ void gaussian5x5(const Tensor<T> &in, Tensor<T> &out, BorderMode border_mode, T
}
}
-// Matrix multiplication for floating point type
-template <typename T, typename std::enable_if<is_floating_point<T>::value, int>::type * = nullptr>
-void gemm(const Tensor<T> &in1, const Tensor<T> &in2, const Tensor<T> &in3, Tensor<T> &out, float alpha, float beta)
-{
- const int M = out.shape().y();
- const int N = out.shape().x();
- const int K = in1.shape().x();
-
- for(int r = 0; r < M; ++r)
- {
- for(int c = 0; c < N; ++c)
- {
- T acc(0);
-
- for(int k = 0; k < K; ++k)
- {
- const T a0 = in1[r * K + k];
- const T b0 = in2[k * N + c];
-
- acc += a0 * b0;
- }
-
- // Finalize the result: A * B * alpha + C * beta
- const T c0 = in3[c + r * N];
- out[c + r * N] = alpha * acc + beta * c0;
- }
- }
-}
-
-// Matrix multiplication for fixed point type
-template <typename T, typename std::enable_if<std::is_integral<T>::value, int>::type * = nullptr>
-void gemm(const Tensor<T> &in1, const Tensor<T> &in2, const Tensor<T> &in3, Tensor<T> &out, float alpha, float beta)
-{
- using namespace fixed_point_arithmetic;
-
- using promoted_type = typename fixed_point_arithmetic::traits::promote<T>::type;
-
- const int M = out.shape().y();
- const int N = out.shape().x();
- const int K = in1.shape().x();
- const int8_t fixed_point_position = static_cast<int8_t>(in1.fixed_point_position());
-
- const fixed_point<T> alpha_q(alpha, fixed_point_position);
- const fixed_point<T> beta_q(beta, fixed_point_position);
-
- for(int r = 0; r < M; ++r)
- {
- for(int c = 0; c < N; ++c)
- {
- fixed_point<promoted_type> acc_q(0, fixed_point_position);
-
- for(int k = 0; k < K; ++k)
- {
- const fixed_point<promoted_type> a0_q(in1[r * K + k], fixed_point_position, true);
- const fixed_point<promoted_type> b0_q(in2[k * N + c], fixed_point_position, true);
- const fixed_point<promoted_type> axb_q = a0_q * b0_q;
-
- acc_q = axb_q + acc_q;
- }
-
- // Finalize the result: A * B * alpha + C * beta
- const fixed_point<T> c0_q(in3[c + r * N], fixed_point_position, true);
-
- fixed_point<T> res_q(acc_q);
- res_q = alpha_q * res_q;
- res_q = (c0_q * beta_q) + res_q;
-
- // Store the result
- out[c + r * N] = res_q.raw();
- }
- }
-}
-
// Non linear filter
template <typename T>
void non_linear_filter(const Tensor<T> &in, Tensor<T> &out, NonLinearFilterFunction function, unsigned int mask_size,