Skip to content

Commit

Permalink
[Test] Add unit tests for newly added tensor type
Browse files Browse the repository at this point in the history
This PR adds unit tests for the recently implemented tensor data types.
The purpose is to ensure their functionality and correctness by performing various test cases.

**Changes proposed in this PR:**
- Added unit tests to test functions for CharTensor and ShortTensor
- Check if both tensor data are contiguous before copy()

**Self-evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test:   [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Donghyeon Jeong <dhyeon.jeong@samsung.com>
  • Loading branch information
djeong20 committed Oct 16, 2024
1 parent fa9aa03 commit 11669e4
Show file tree
Hide file tree
Showing 2 changed files with 546 additions and 44 deletions.
2 changes: 1 addition & 1 deletion nntrainer/tensor/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ size_t Tensor::getOffset() const { return itensor->getOffset(); }

void Tensor::copy(const Tensor &from) {
/// @todo enable copy to non-contiguous tensor
if (!itensor->getContiguous()) {
if (!itensor->getContiguous() || !from.getContiguous()) {
throw std::runtime_error("Cannot copy non-contiguous tensor");
}

Expand Down
Loading

0 comments on commit 11669e4

Please sign in to comment.