You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use a dataloader to iterate through objects in a dataset.
However, it seems that the dataloader gets stuck when the arrays have different sizes. I assume the dataloader would like to return a nparray of shape (batch_size, my_size) but the kernel freezes without any error message.
If dataloader could pad the arrays with 0 (or something that the user can choose) it would solve my problem. Note that if the numpy arrays have the same length then the code works.
You can reproduce the issue like this:
import mxnet as mx
import numpy as np
batch_test = [np.array([1,2,3,1,2,6])]
batch_test.append(np.array([3,2,1,1,5]))
batch_test.append(np.array([3,1,2,6]))
batch_test.append(np.array([1,2,2,6]))
batch_test.append(np.array([1,4]))
dataset = mx.gluon.data.dataset.ArrayDataset(batch_test, batch_test)
from multiprocessing import cpu_count
CPU_COUNT = cpu_count()
data_loader = mx.gluon.data.DataLoader(dataset, batch_size=3, num_workers=1) #CPU_COUNT)
print('We do get here')
for X_batch, y_batch in data_loader:
print("X_batch has shape {}, and y_batch has shape {}".format(X_batch.as_in_context(ctx).shape, y_batch.shape))
print('But we never get here')
The text was updated successfully, but these errors were encountered:
I would like to use a dataloader to iterate through objects in a dataset.
However, it seems that the dataloader gets stuck when the arrays have different sizes. I assume the dataloader would like to return a nparray of shape (batch_size, my_size) but the kernel freezes without any error message.
If dataloader could pad the arrays with 0 (or something that the user can choose) it would solve my problem. Note that if the numpy arrays have the same length then the code works.
You can reproduce the issue like this:
The text was updated successfully, but these errors were encountered: