DickJC123 opened a new pull request #20365:
URL: https://github.com/apache/incubator-mxnet/pull/20365


   ## Description ##
   
   Tensor shapes can be interpreted in one of two modes, depending on whether 
"numpy shape semantics" have been enabled.  There are unittests that test shape 
handling in both modes, but any one unittest should not make assumptions about 
the prevailing mode entering the test, nor should it permanently alter the mode 
for tests that follow (regardless of whether the test passes or fails).  **This 
PR fixes the test_operator.py::test_zero_sized_dim test, which was leaving 
numpy shape semantics set for follow-on tests.**  Running the test was found to 
cause failures in a following test_sparse_ndarray.py::def test_sparse_nd_pickle 
among other tests, as reported in issue 
https://github.com/apache/incubator-mxnet/issues/20337.  This PR also fixes 
test_operator.py::test_boolean_mask and 
test_thread_local.py::test_np_global_shape, which do not properly save and 
restore the pre-test shape interpretation mode.
   
   When running pytest with xdist and multiple workers, I'm not sure if the 
same set of tests are run on the same workers.  If the assignment of tests to 
workers is non-deterministic, then failures of susceptible tests may be 
non-deterministic.  In that case, this PR may also fix the non-deterministic 
issue https://github.com/apache/incubator-mxnet/issues/19915.
   
   Regarding implementation, I chose not to use the more elegant np_shape() or 
use_np_shape() decorators in fixing these tests.  Instead, I kept the use of 
set_np_shape() in order to retain some direct testing of this function from the 
unittests.
   
   ## Checklist ##
   ### Essentials ###
   - [ X] PR's title starts with a category (e.g. [BUGFIX], [MODEL], 
[TUTORIAL], [FEATURE], [DOC], etc)
   - [ X] Changes are complete (i.e. I finished coding on this PR)
   - [ X] All changes have test coverage
   - [X ] Code is well-documented
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   


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


Reply via email to