From 9a3f5e4c9b292fbf8fd06ef264788771ae68565a Mon Sep 17 00:00:00 2001 From: skykongkong8 Date: Fri, 23 Feb 2024 10:51:10 +0900 Subject: [PATCH] [ TensorV2 ] Apply changes made from ele-wise SIMD operations - Like commit#7363546, alpha option in ewva should be set to 1, not 0. - Change function name : ew* -> ele_* **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: skykongkong8 --- nntrainer/tensor/half_tensor.cpp | 4 ++-- nntrainer/tensor/tensor.cpp | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/nntrainer/tensor/half_tensor.cpp b/nntrainer/tensor/half_tensor.cpp index d0e25b4bf4..f352177bda 100644 --- a/nntrainer/tensor/half_tensor.cpp +++ b/nntrainer/tensor/half_tensor.cpp @@ -510,8 +510,8 @@ TensorV2 &HalfTensor::add(TensorV2 const &m, TensorV2 &output, float const alpha) const { auto f = [&](const BroadcastInfoV2 &e, const _FP16 *buf, const _FP16 *m_buf, _FP16 *out_buf) { - if (e.strides[3] == 1 && strides[3] == 1 && strides[3] == 1 && alpha == 0) { - ewva(e.buffer_size, buf, m_buf, out_buf); + if (e.strides[3] == 1 && strides[3] == 1 && strides[3] == 1 && alpha == 1) { + ele_add(e.buffer_size, buf, m_buf, out_buf); } else { for (unsigned int i = 0; i < e.buffer_size; ++i) { *out_buf = *buf + *m_buf * static_cast<_FP16>(alpha); diff --git a/nntrainer/tensor/tensor.cpp b/nntrainer/tensor/tensor.cpp index b73ceef716..a63f3216e5 100644 --- a/nntrainer/tensor/tensor.cpp +++ b/nntrainer/tensor/tensor.cpp @@ -127,8 +127,7 @@ class SrcSharedTensor { SrcSharedTensor() : src(nullptr), off(0) {} SrcSharedTensor(const Tensor *tensor, size_t offset) : - src(tensor), - off(offset) {} + src(tensor), off(offset) {} /** * @brief Get the allocated src tensor