pengzhao-intel commented on a change in pull request #15697: Fix dropout mask 
output when built with MKL
URL: https://github.com/apache/incubator-mxnet/pull/15697#discussion_r310365937
 
 

 ##########
 File path: src/operator/nn/dropout-inl.h
 ##########
 @@ -130,11 +130,18 @@ class DropoutOp {
     DType *dataptr = data.dptr_;
     auto maskptr = reinterpret_cast<int *>(mask.dptr_);
     int count = mask.shape_[0] * mask.shape_[1];
+    if (sizeof(DType) > sizeof(int)) {
+      // allocating new buffer to avoiding memory overlapping between 
`mask.dptr_` and `maskptr`
+      Tensor<xpu, 1, int> temp = ctx.requested[1].get_space_typed<xpu, 1, 
int>(Shape1(count), s);
+      maskptr = temp.dptr_;
 
 Review comment:
   will temp be deleted when out of if section?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to