Skip to content

Conversation

@bitzyz
Copy link
Contributor

@bitzyz bitzyz commented Jan 11, 2024

No description provided.

@bitzyz bitzyz self-assigned this Jan 11, 2024
@bitzyz bitzyz force-pushed the dev-hardswish branch 2 times, most recently from e37e395 to baaeac7 Compare January 12, 2024 07:15
@bitzyz bitzyz added kernel Add or modify kernel implementation operator Add or modify frontend/computation operator labels Jan 12, 2024
@bitzyz bitzyz linked an issue Jan 12, 2024 that may be closed by this pull request
7 tasks
@bitzyz bitzyz requested a review from YdrMaster January 12, 2024 07:25
return static_cast<T>(std::tanh(static_cast<M>(x)));
}
template<class T> auto hardswishFun(T x) noexcept -> T {
return x * (std::max(0., std::min(1., 1.f / 6 * x + 0.5)));
Copy link
Contributor

Choose a reason for hiding this comment

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

对于 cpu 来说这个可以表述成分支吧,if x/6 < -0.5 直接 return 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix

Signed-off-by: YdrMaster <ydrml@hotmail.com>
@YdrMaster YdrMaster merged commit a163eee into dev Jan 18, 2024
@YdrMaster YdrMaster deleted the dev-hardswish branch January 18, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kernel Add or modify kernel implementation operator Add or modify frontend/computation operator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hardswish

3 participants