Skip to content

Commit

Permalink
[ Tensor ] copyData to fp16 from fp32
Browse files Browse the repository at this point in the history
- copyData function now supports fp16_fp32 conversion

**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 1, 2024
1 parent 4cf814e commit 5a8df83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nntrainer/tensor/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3092,7 +3092,9 @@ void Tensor::copyData(const Tensor &from) {
}
} else if (getDataType() == ml::train::TensorDim::DataType::FP16) {
#ifdef ENABLE_FP16
if (from.getDataType() == ml::train::TensorDim::DataType::QINT8) {
if (from.getDataType() == ml::train::TensorDim::DataType::FP32) {
scopy(size(), from.getData<float>(), 1, getData<_FP16>(), 1);
} else if (from.getDataType() == ml::train::TensorDim::DataType::QINT8) {
scopy_int8_to_float16(from.size(), from.getData<uint8_t>(), 1,
getData<_FP16>(), 1);
} else if (from.getDataType() == ml::train::TensorDim::DataType::QINT4) {
Expand Down

0 comments on commit 5a8df83

Please sign in to comment.