fierceX opened a new pull request #16233: Fix dataloader bug
URL: https://github.com/apache/incubator-mxnet/pull/16233
 
 
   ## Description ##
   When multi-process is enabled, when the last batch size is 1, there will be 
no batch size in the shape of the last returned data.
   
   I deleted a line of code and I don't know why there is this line of code.
   I have no problem after I delete it.
   
   E.g:
   ---
   1. 
   ```python
   import mxnet as mx
   import numpy as np
   from mxnet.gluon.data import ArrayDataset,DataLoader
   
   data = np.ones((1,11,12))
   print(data.shape)
   new_data =  ArrayDataset(data)
   dataloader = 
gluon.data.DataLoader(new_data,batch_size=1024,last_batch='keep',num_workers=2)
   for d in dataloader:
       print(d.shape)
   ```
   output:
   ```
   (1, 11, 12)
   (11, 12)
   ```
   ---
   2.
   ```python
   import mxnet as mx
   import numpy as np
   from mxnet.gluon.data import ArrayDataset,DataLoader
   
   data = np.ones((1,11,12))
   print(data.shape)
   new_data =  ArrayDataset(data)
   dataloader = 
gluon.data.DataLoader(new_data,batch_size=1024,last_batch='keep')
   for d in dataloader:
       print(d.shape)
   ```
   output:
   ```
   (1, 11, 12)
   (1, 11, 12)
   ```
   ---
   3.
   ```python
   import mxnet as mx
   import numpy as np
   from mxnet.gluon.data import ArrayDataset,DataLoader
   
   data = np.ones((1025,11,12))
   print(data.shape)
   new_data =  ArrayDataset(data)
   dataloader = 
gluon.data.DataLoader(new_data,batch_size=1024,last_batch='keep',num_workers=2)
   for d in dataloader:
       print(d.shape)
   ```
   output:
   ```
   (1025, 11, 12)
   (1024, 11, 12)
   (11, 12)
   ```
   ---
   4.
   ```python
   import mxnet as mx
   import numpy as np
   from mxnet.gluon.data import ArrayDataset,DataLoader
   
   data = np.ones((1,11,12))
   print(data.shape)
   new_data =  ArrayDataset(data)
   dataloader = 
gluon.data.DataLoader(new_data,batch_size=1024,last_batch='keep')
   for d in dataloader:
       print(d.shape)
   ```
   output:
   ```
   (1025, 11, 12)
   (1024, 11, 12)
   (1, 11, 12)
   ```
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [x] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [x] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Interesting edge cases to note here
   

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