projects
/
platform
/
core
/
ml
/
nntrainer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
27df227
)
[Bug] Fix memory access error in addValue
author
Donghyeon Jeong
<dhyeon.jeong@samsung.com>
Thu, 20 Jul 2023 07:51:37 +0000
(16:51 +0900)
committer
Jijoong Moon
<jijoong.moon@samsung.com>
Mon, 21 Aug 2023 06:29:23 +0000
(15:29 +0900)
- Previously memory access to tensor data was incorrect
- Change to direct access to data with index instead of calculating the index
Signed-off-by: Donghyeon Jeong <dhyeon.jeong@samsung.com>
nntrainer/tensor/tensor.h
patch
|
blob
|
history
diff --git
a/nntrainer/tensor/tensor.h
b/nntrainer/tensor/tensor.h
index
ad68f37
..
eb1279f
100644
(file)
--- a/
nntrainer/tensor/tensor.h
+++ b/
nntrainer/tensor/tensor.h
@@
-1315,9
+1315,11
@@
public:
unsigned int w, float value, float beta) noexcept {
auto const &idx = getIndex(batch, c, h, w);
if (dim.getDataType() == Tdatatype::FP32) {
- *(float *)(getData(idx)) = value + *(float *)(getData(idx)) * beta;
+ getData<float>()[idx] *= beta;
+ getData<float>()[idx] += value;
} else if (dim.getDataType() == Tdatatype::FP16) {
- *(__fp16 *)(getData(idx)) = value + *(__fp16 *)(getData(idx)) * beta;
+ getData<__fp16>()[idx] *= beta;
+ getData<__fp16>()[idx] += value;
}
}