Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tensor] Fix improper vector initialization in Tensor::split function #2901

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

djeong20
Copy link
Contributor

@djeong20 djeong20 commented Jan 24, 2025

This pull request addresses the issue of improper vector initialization that leads to an error in the Tensor::split function. Previously, the vector was reserved but accessed directly without inserting any elements. Reserving memory only allocates space internally, leaving the vector uninitialized.

Changes proposed in this PR:

  • Initialize the vector using the constructor that takes "count copies of elements."
  • Properly initialize tensors when they are added to a vector of tensors.

Self-evaluation:

  1. Build test: [X]Passed [ ]Failed [ ]Skipped
  2. Run test: [X]Passed [ ]Failed [ ]Skipped

Copy link
Member

@skykongkong8 skykongkong8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this suggestion itself sounds good, it seems this won't fix #2900..

Copy link
Contributor

@EunjuYang EunjuYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

This pull request addresses the issue of improper vector initialization that leads to an error in the Tensor::split function.
Previously, the vector was reserved but accessed directly without inserting any elements.
Reserving memory only allocates space internally, leaving the vector uninitialized.

**Changes proposed in this PR:**
- Initialize the vector using the constructor that takes count copies of elements.
- Properly initialize tensors when they are added to a vector of tensors.

**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>
@djeong20 djeong20 changed the title [hotfix] modify tensor split unit tests [Tensor] Fix improper vector initialization in Tensor::split function Jan 24, 2025
@djeong20 djeong20 linked an issue Jan 24, 2025 that may be closed by this pull request
@djeong20 djeong20 added the bug Something isn't working label Jan 24, 2025
@EunjuYang
Copy link
Contributor

Thanks for your hard work to fix it ! 👍

Copy link
Collaborator

@dkjung dkjung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

@haehun haehun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@myungjoo myungjoo merged commit 725acf9 into nnstreamer:main Jan 31, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR/READY2MERGE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible FP16/FP32 Bug. Unittest fails
6 participants