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/10/12 02:27:53 UTC

[GitHub] [incubator-mxnet] szha commented on a change in pull request #20587: [API] Add bitwise_left/right_shift

szha commented on a change in pull request #20587:
URL: https://github.com/apache/incubator-mxnet/pull/20587#discussion_r726712209



##########
File path: src/common/cuda/rtc/backward_functions-inl.h
##########
@@ -426,6 +426,48 @@ copysign_grad(const DType val,
   return (val >= 0 && val2 >= 0) || (val < 0 && val2 < 0) ? 1 : -1;
 }
 
+template <typename DType, typename DType2>
+__device__ inline mixed_type<DType, DType2>
+bitwise_left_shift_grad(const DType val,
+                        const DType2 val2) {
+  return op::power(static_cast<DType>(2), val2);
+}
+
+template <typename DType, typename DType2>
+__device__ inline mixed_type<DType, DType2>
+bitwise_left_shift_rgrad(const DType val,
+                         const DType2 val2) {
+  return val * op::power(static_cast<DType>(2), val2) * op::log(static_cast<type>(2));

Review comment:
       what does the `type` in `static_cast<type>` refer to?




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@mxnet.apache.org

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