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

[bugfix] fix coverity issues #2722

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

djeong20
Copy link
Contributor

This PR resolves coverity issues in the ShortTensor class. Replace max_abs() implementation with maxValue() since the maximum absolute value of unsigned int equals to the maximum value.

Self-evaluation:

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

This PR resolves coverity issues in the ShortTensor class.
Replace max_abs() implementation with maxValue() since the maximum absolute value of unsigned int equals to the maximum value.

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

Signed-off-by: Donghyeon Jeong <[email protected]>
@taos-ci
Copy link
Collaborator

taos-ci commented Aug 29, 2024

📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #2722. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://ci.nnstreamer.ai/.

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.
BTW, ShortTensor sounds like int16 not uint16 (It made me confused). Please think rename this when one adds int16 tensor :)

Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

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

@djeong20, 💯 All CI checkers are successfully verified. Thanks.

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.

LGTM!

@skykongkong8
Copy link
Member

skykongkong8 commented Aug 29, 2024

LGTM. BTW, ShortTensor sounds like int16 not uint16 (It made me confused). Please think rename this when one adds int16 tensor :)

I agree. I think it would be better to have something that clarifies its characteristics such as unsigend or quantized, etc


return max_val;
}
float ShortTensor::max_abs() const { return maxValue(); }

float ShortTensor::maxValue() const {
Copy link
Member

@skykongkong8 skykongkong8 Aug 29, 2024

Choose a reason for hiding this comment

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

And just curious, if this tensor is containing 'unsigned' integer, why should it be max_"abs" ? it is already absolute.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry I didn't quite understand. do you mean why max_abs() should be used?

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I think can't see any difference between maxValue and maxAbsoluteValue for this tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! There's no difference between max_abs() and maxValue() for this tensor class. That's why max_abs() is using maxValue(). The reason why there are max_abs() and maxValue() is to be compatible with the TensorBase and Tensor class. While max_abs() is currently a pure virtual function, it will get a compile error without implementing max_abs() in the ShortTensor class.

Copy link
Contributor

@baek2sm baek2sm 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
Contributor

@lhs8928 lhs8928 left a comment

Choose a reason for hiding this comment

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

LGTM

@jijoongmoon jijoongmoon merged commit 656a231 into nnstreamer:main Aug 30, 2024
45 checks passed
@djeong20 djeong20 deleted the fix/coverity/082924 branch October 16, 2024 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants