-
Notifications
You must be signed in to change notification settings - Fork 75
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
[Test] TensorV2 multiplication unit test #2433
Conversation
📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #2433. 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/. |
_FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), | ||
static_cast<_FP16>(4), static_cast<_FP16>(9), | ||
static_cast<_FP16>(16), static_cast<_FP16>(25), | ||
static_cast<_FP16>(36), static_cast<_FP16>(49), | ||
static_cast<_FP16>(64), static_cast<_FP16>(81), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these static_cast to _FP16 is making readability very low.
if anyone has a good idea, please give me a suggestion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you make Macro or Function that can convert to FP16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example
template <typename T> // T models Any
struct static_cast_func
{
template <typename T1> // T1 models type statically convertible to T
T operator()(const T1& x) const { return static_cast<T>(x); }
};
std::transform(char_buff, char_buff + len, float_buff, static_cast_func<float>());
like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks :) this really helped a lot
There was a problem hiding this 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.
float *indata = input.getData<float>(); | ||
ASSERT_NE(nullptr, indata); | ||
|
||
for (int i = 0; i < batch * height * width * channel; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < batch * height * width * channel; ++i) { | |
for (int i = 0; i < batch * channel * height * width; ++i) { |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
This PR includes unit tests for verifying multiplication operations in the TensorV2 class. Note that all unit tests are the same as tests in unittest_nntrainer_tensor.cpp file. **Self-evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Donghyeon Jeong <[email protected]>
…orm() This commit replaces a manual static_cast operation with a helper struct that can be used with std::transform(). This change improves readability and maintainability by encapsulating the casting logic in a separate struct. suggessted by @DonghakPark Co-authored-by: Donghak Park <[email protected]> Signed-off-by: Donghyeon Jeong <[email protected]>
cf26b09
to
d05bdc1
Compare
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR includes unit tests for verifying multiplication operations in the TensorV2 class.
Note that all unit tests are the same as tests in unittest_nntrainer_tensor.cpp file.
Self-evaluation: