From 83b3a76dec11f55f4541707f6e7af7178159958c Mon Sep 17 00:00:00 2001 From: skykongkong8 Date: Tue, 16 Jul 2024 12:06:29 +0900 Subject: [PATCH] [ util ] Change name swish -> swiglu - There was a typo in swiglu function. With Z element multiplication, this function is swiglu, not a swish **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: skykongkong8 --- nntrainer/utils/util_simd.cpp | 8 ++++---- nntrainer/utils/util_simd.h | 8 ++++---- nntrainer/utils/util_simd_neon.cpp | 4 ++-- nntrainer/utils/util_simd_neon.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nntrainer/utils/util_simd.cpp b/nntrainer/utils/util_simd.cpp index 2ec89872..81aa88eb 100644 --- a/nntrainer/utils/util_simd.cpp +++ b/nntrainer/utils/util_simd.cpp @@ -28,9 +28,9 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_, #endif } -void swish(const unsigned int N, float *X, float *Y, float *Z) { +void swiglu(const unsigned int N, float *X, float *Y, float *Z) { #ifdef USE_NEON - nntrainer::neon::swish(N, X, Y, Z); + nntrainer::neon::swiglu(N, X, Y, Z); #else unsigned int i = 0; while (i < N) { @@ -83,9 +83,9 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_, #endif } -void swish(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z) { +void swiglu(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z) { #ifdef USE_NEON - nntrainer::neon::swish(N, X, Y, Z); + nntrainer::neon::swiglu(N, X, Y, Z); #else unsigned int i = 0; while (i < N) { diff --git a/nntrainer/utils/util_simd.h b/nntrainer/utils/util_simd.h index 9dafc170..26bf8080 100644 --- a/nntrainer/utils/util_simd.h +++ b/nntrainer/utils/util_simd.h @@ -32,14 +32,14 @@ namespace nntrainer { void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_, float *sin_, unsigned int alpha = 1.0); /** - * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z + * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z * * @param N number of elements in X * @param X float * for Vector X * @param Y float * for Vector Y * @param Z float * for Vector Z */ -void swish(const unsigned int N, float *X, float *Y, float *Z); +void swiglu(const unsigned int N, float *X, float *Y, float *Z); /** * @brief returns maximum value of the vector X @@ -75,14 +75,14 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_, unsigned int w, _FP16 *in, _FP16 *out, float *cos_, float *sin_); /** - * @brief swish function : X = (Y / (1 + exp( -Y ))) * Z + * @brief swiglu function : X = (Y / (1 + exp( -Y ))) * Z * * @param N number of elements in X * @param X _FP16 * for Vector X * @param Y _FP16 * for Vector Y * @param Z _FP16 * for Vector Z */ -void swish(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z); +void swiglu(const unsigned int N, _FP16 *X, _FP16 *Y, _FP16 *Z); /** * @brief returns maximum value of the vector X diff --git a/nntrainer/utils/util_simd_neon.cpp b/nntrainer/utils/util_simd_neon.cpp index a76f8883..d8238970 100644 --- a/nntrainer/utils/util_simd_neon.cpp +++ b/nntrainer/utils/util_simd_neon.cpp @@ -35,7 +35,7 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_, } } -void swish(const unsigned int N, float *X, float *Y, float *Z) { +void swiglu(const unsigned int N, float *X, float *Y, float *Z) { unsigned int i = 0; for (; N - i >= VL_FP32; i += VL_FP32) { float32x4_t y0_3 = vld1q_f32(&Y[i]); @@ -186,7 +186,7 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_, } } -void swish(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z) { +void swiglu(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z) { unsigned int i = 0; for (; N - i >= VL_FP16; i += VL_FP16) { float16x8_t y0_7 = vld1q_f16(&Y[i]); diff --git a/nntrainer/utils/util_simd_neon.h b/nntrainer/utils/util_simd_neon.h index e838ea85..aea5a4d1 100644 --- a/nntrainer/utils/util_simd_neon.h +++ b/nntrainer/utils/util_simd_neon.h @@ -32,14 +32,14 @@ void calc_trigonometric_vals_dup(unsigned int N_half, float *angle, float *cos_, float *sin_, unsigned int alpha = 1.0); /** - * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z + * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z * * @param N number of elements in X * @param X float * for Vector X * @param Y float * for Vector Y * @param Z float * for Vector Z */ -void swish(const unsigned int N, float *X, float *Y, float *Z); +void swiglu(const unsigned int N, float *X, float *Y, float *Z); /** * @brief returns maximum value of the vector X @@ -82,14 +82,14 @@ void compute_rotary_embedding_value(unsigned int dim, unsigned int half_, unsigned int w, __fp16 *in, __fp16 *out, float *cos_, float *sin_); /** - * @brief swish function with neon : X = (Y / (1 + exp( -Y ))) * Z + * @brief swiglu function with neon : X = (Y / (1 + exp( -Y ))) * Z * * @param N number of elements in X * @param X __fp16 * for Vector X * @param Y __fp16 * for Vector Y * @param Z __fp16 * for Vector Z */ -void swish(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z); +void swiglu(const unsigned int N, __fp16 *X, __fp16 *Y, __fp16 *Z); /** * @brief returns maximum value of the vector X -- 2.34.1