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

 ##########
 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:
   I have reverted the changes for floating numbers. Changing ``memcmp` to 
`AssertEqual` is out of the scope of this PR, so I will keep it as is.
   
   > Or we can just increase max to filling more different numbers other than 
only -1 and 0.
   
   I was thinking about including number 2 into the generated tensor but found 
that with the given shapes, there still has chance to get error. That means for 
the worst case, the intermediate accumulation value will be > 2^24, so the 1 
will be ignored when accumulating another 1 to  it.

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