You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/05/28 04:58:38 UTC

[GitHub] [incubator-mxnet] Adnios opened a new pull request #20320: [operator] Add Mish Activation Function

Adnios opened a new pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320


   ## Description ##
   Add Mish Activation Function.
   Related issus: https://github.com/apache/incubator-mxnet/issues/16841
   The pr(https://github.com/apache/incubator-mxnet/pull/17696) seem to be dead.
   
   ## Checklist ##
   ### Essentials ###
   - [x] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage
   - [ ] Code is well-documented
   
   ### Changes ###
   - [x] Add native mish implementation
   - [x] Integrate oneDNN implementation
   
   ## Comments ##
   - This is mostly a copycat of log_sigmoid activation function. I referenced a lot of code during the implementation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-856837688


   @szha Please help review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-850131109


   Hey @Adnios , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [centos-gpu, unix-cpu, windows-gpu, miscellaneous, clang, website, windows-cpu, sanity, edge, centos-cpu, unix-gpu]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-852844290


   @mseth10  could you remove label pr-awaiting-review and add label pr-work-in-progress?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on a change in pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
Adnios commented on a change in pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#discussion_r648759877



##########
File path: src/common/cuda/rtc/forward_functions-inl.h
##########
@@ -694,6 +694,15 @@ __device__ inline DType log_sigmoid(const DType val) {
   }
 }
 
+template <typename DType>
+__device__ inline DType mish(const DType val) {
+  if (type_util::has_double_or_integral<DType>::value) {
+    return val * ::tanh(::log(1 + ::exp(val)));

Review comment:
       Yes. Thanks for your advice.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-855188776


   @mxnet-bot run ci [centos-gpu, unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-855188785


   Jenkins CI successfully triggered : [centos-gpu, unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] digantamisra98 commented on a change in pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
digantamisra98 commented on a change in pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#discussion_r648669856



##########
File path: src/common/cuda/rtc/forward_functions-inl.h
##########
@@ -694,6 +694,15 @@ __device__ inline DType log_sigmoid(const DType val) {
   }
 }
 
+template <typename DType>
+__device__ inline DType mish(const DType val) {
+  if (type_util::has_double_or_integral<DType>::value) {
+    return val * ::tanh(::log(1 + ::exp(val)));

Review comment:
       Yes, agreed, usually Softplus has an upper bound of 20.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha merged pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
szha merged pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
szha commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-856934023


   @Adnios merged. Thank you for the contribution!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#issuecomment-852590136


   > Thanks for the contribution! Going forward in 2.0, as we will mainly use np/npx instead of sym, could you also include a test for it with npx.activation?
   
   Sure. Thanks for advice.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] ptrendx commented on a change in pull request #20320: [operator] Add Mish Activation Function

Posted by GitBox <gi...@apache.org>.
ptrendx commented on a change in pull request #20320:
URL: https://github.com/apache/incubator-mxnet/pull/20320#discussion_r648547822



##########
File path: src/common/cuda/rtc/forward_functions-inl.h
##########
@@ -694,6 +694,15 @@ __device__ inline DType log_sigmoid(const DType val) {
   }
 }
 
+template <typename DType>
+__device__ inline DType mish(const DType val) {
+  if (type_util::has_double_or_integral<DType>::value) {
+    return val * ::tanh(::log(1 + ::exp(val)));

Review comment:
       One thing that could be improved here (I did not notice this PR earlier, sorry for a late feedback) is the numerical stability of the softrelu part - see the implementation of the softrelu (it switches to softrelu(x) = x for large values of x to avoid overflow). @Adnios could you open another PR changing e.g. this function to
   ```
   return val * op::tanh(op::softrelu(val));
   ```
   (the double vs float is handled in op::tanh and op::softrelu anyway so this one will also be simpler as a result) and similarly backward?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org