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 2020/01/06 08:40:29 UTC

[GitHub] [incubator-mxnet] Alicia1529 opened a new pull request #17222: fix flaky test: boolean index and fix bugs

Alicia1529 opened a new pull request #17222: fix flaky test: boolean index and fix bugs
URL: https://github.com/apache/incubator-mxnet/pull/17222
 
 
   1. fix the problem in issue #17219: 
   As the variable val is a mxnet.numpy.array, the operation `np_data[np_mask] = val` actually fall back to mxnet operation
   2. handle boolean indexing on 0-d array and index as primitive boolean type. For example:
   ```
   >>> from mxnet import np, npx
   >>> npx.set_np()
   >>> import numpy as _np
   >>> mx_a = np.array(1)
   >>> np_a = _np.array(1)
   >>> mx_a[True]
   array([1.])
   >>> mx_a[False]
   array([])
   >>> np_a[True]
   array([1])
   >>> np_a[False]
   array([], dtype=int64)
   ```

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


With regards,
Apache Git Services

[GitHub] [incubator-mxnet] Kh4L commented on a change in pull request #17222: fix flaky test: boolean index and fix bugs

Posted by GitBox <gi...@apache.org>.
Kh4L commented on a change in pull request #17222: fix flaky test: boolean index and fix bugs
URL: https://github.com/apache/incubator-mxnet/pull/17222#discussion_r363379075
 
 

 ##########
 File path: tests/python/unittest/test_numpy_op.py
 ##########
 @@ -1296,10 +1296,9 @@ def hybrid_forward(self, F, a, mask, value):
 
     for hybridize in [False]:
         for config in configs:
-            print(config)
             dshape, mshape, start_axis = config
             test_data = np.random.uniform(size=dshape)
-            mx_mask = np.around(np.random.uniform(size=mshape))
+            mx_mask = np.around(np.random.uniform(size=mshape)).astype(np.bool)
 
 Review comment:
   Nitpicking:
   
   ```suggestion
               mx_mask = np.random.choice(a=[False, True], size=mshape)
   ```

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


With regards,
Apache Git Services

[GitHub] [incubator-mxnet] haojin2 merged pull request #17222: fix flaky test: boolean index and fix bugs

Posted by GitBox <gi...@apache.org>.
haojin2 merged pull request #17222: fix flaky test: boolean index and fix bugs
URL: https://github.com/apache/incubator-mxnet/pull/17222
 
 
   

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


With regards,
Apache Git Services

[GitHub] [incubator-mxnet] Alicia1529 commented on a change in pull request #17222: fix flaky test: boolean index and fix bugs

Posted by GitBox <gi...@apache.org>.
Alicia1529 commented on a change in pull request #17222: fix flaky test: boolean index and fix bugs
URL: https://github.com/apache/incubator-mxnet/pull/17222#discussion_r363392042
 
 

 ##########
 File path: tests/python/unittest/test_numpy_op.py
 ##########
 @@ -1296,10 +1296,9 @@ def hybrid_forward(self, F, a, mask, value):
 
     for hybridize in [False]:
         for config in configs:
-            print(config)
             dshape, mshape, start_axis = config
             test_data = np.random.uniform(size=dshape)
-            mx_mask = np.around(np.random.uniform(size=mshape))
+            mx_mask = np.around(np.random.uniform(size=mshape)).astype(np.bool)
 
 Review comment:
   Thanks for your suggestions. I added this change just now : )

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


With regards,
Apache Git Services