TaoLv commented on a change in pull request #17318: Enable MKL-DNN 
FullyConnected backward
URL: https://github.com/apache/incubator-mxnet/pull/17318#discussion_r379905050
 
 

 ##########
 File path: tests/cpp/include/test_mkldnn.h
 ##########
 @@ -63,24 +63,24 @@ struct TestArrayShapes {
 };
 
 // Init arrays with the default layout.
-inline static void InitDefaultArray(NDArray *arr, bool is_rand = false) {
+inline static void InitDefaultArray(NDArray *arr, bool is_rand = false, int 
max = 50) {
   const TBlob &blob = arr->data();
   mshadow::default_real_t *data = blob.dptr<mshadow::default_real_t>();
   int size = blob.Size();
 
   for (int i = 0; i < size; i++)
     if (is_rand) {
-      data[i] = (std::rand() % 100) - 50;
+      data[i] = (std::rand() % (max * 2)) - max;
 
 Review comment:
   Okay, i will change to generate float numbers in [-max, max) rather than 
integer numbers. Previously I thought sparse (say 50% zeros) is also a way to 
avoid float number accumulation error.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to