From 1997a134360de28f6fbe8143b78dd2d6eaafaa36 Mon Sep 17 00:00:00 2001 From: eclipsess Date: Thu, 8 Nov 2018 19:49:27 +0800 Subject: [PATCH] add gru Sgemm_omp --- src/operators/math/gru_compute.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/operators/math/gru_compute.cpp b/src/operators/math/gru_compute.cpp index 8ebf92059b..9e77f572c5 100644 --- a/src/operators/math/gru_compute.cpp +++ b/src/operators/math/gru_compute.cpp @@ -30,20 +30,34 @@ struct GRUUnitFunctor { const ActivationType active_gate) { Gemm gemm; if (value.prev_out_value) { +#ifdef _OPENMP + gemm.Sgemm_omp(batch_size, frame_size * 2, frame_size, 1, + value.prev_out_value, frame_size, value.gate_weight, + frame_size * 2, 1, value.gate_value, frame_size * 3, false, + nullptr); +#else gemm.Sgemm(batch_size, frame_size * 2, frame_size, 1, value.prev_out_value, frame_size, value.gate_weight, frame_size * 2, 1, value.gate_value, frame_size * 3, false, nullptr); +#endif } forward_reset_output(forward::gru_resetOutput(), value, frame_size, batch_size, active_gate); if (value.prev_out_value) { +#ifdef _OPENMP + gemm.Sgemm_omp(batch_size, frame_size, frame_size, 1, + value.reset_output_value, frame_size, value.state_weight, + frame_size, 1, value.gate_value + frame_size * 2, + frame_size * 3, false, nullptr); +#else gemm.Sgemm(batch_size, frame_size, frame_size, 1, value.reset_output_value, frame_size, value.state_weight, frame_size, 1, value.gate_value + frame_size * 2, frame_size * 3, false, nullptr); +#endif } forward_final_output(forward::gru_finalOutput(), value, frame_size, -- GitLab