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 2019/12/06 18:32:11 UTC
[GitHub] [incubator-mxnet] cuibuaa opened a new issue #16994: DataLoader:
Missing batch_size dim when num_workers > 0
cuibuaa opened a new issue #16994: DataLoader: Missing batch_size dim when num_workers > 0
URL: https://github.com/apache/incubator-mxnet/issues/16994
## Description
When num_workers is not 0, Dataloader misses batch_size dimension for the last batch with one sample.
### Error Message
No specific error trace, but this issue will cause a series of errors for the last batch samples
## To Reproduce
```
from mxnet import gluon
class CustomDataSet(gluon.data.Dataset):
def __init__(self, data):
self.np_array = np.array(data)
def __len__(self):
return self.np_array.shape[0]
def __getitem__(self, idx):
data = self.np_array[idx]
return data
test_ds = CustomDataSet([[1,1,1,1] for _ in range(5)])
test_dl = gluon.data.DataLoader(test_ds, 4, last_batch='keep', num_workers=1) # could be any value > 0
cnt = 0
for x in test_dl:
if cnt == len(test_dl) - 1:
print(x)
cnt += 1
```
### Steps to reproduce
1. if num_workers > 0, the output is :
[1 1 1 1]
<NDArray 4 @cpu_shared(0)>
2. if num_workers = 0, the output is:
[[1 1 1 1]]
<NDArray 1x4 @cpu(0)>
## What have you tried to solve it?
No
## Environment
We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:
```
curl --retry 10 -s https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | python
# paste outputs here
```
----------Python Info----------
Version : 3.6.6
Compiler : GCC 7.2.0
Build : ('default', 'Jun 28 2018 17:14:51')
Arch : ('64bit', '')
------------Pip Info-----------
Version : 19.3.1
Directory : /home/ubuntu/anaconda3/lib/python3.6/site-packages/pip
----------MXNet Info-----------
No MXNet installed.
----------System Info----------
Platform : Linux-4.4.0-1096-aws-x86_64-with-debian-stretch-sid
system : Linux
node : xxxxxxx
release : 4.4.0-1096-aws
version : #107-Ubuntu SMP Thu Oct 3 01:51:58 UTC 2019
----------Hardware Info----------
machine : x86_64
processor : x86_64
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 79
Model name: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
Stepping: 1
CPU MHz: 2700.343
CPU max MHz: 3000.0000
CPU min MHz: 1200.0000
BogoMIPS: 4600.14
Hypervisor vendor: Xen
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 46080K
NUMA node0 CPU(s): 0-7
----------------------------------------------------------------
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