Skip to content

Commit

Permalink
[ TensorV2 ] Apply changes made from ele-wise SIMD operations
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
skykongkong8 committed Feb 23, 2024
1 parent b6d2914 commit 9a3f5e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions nntrainer/tensor/half_tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions nntrainer/tensor/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a3f5e4

Please sign in to comment.