udacity/deep-learning-v2-pytorch

batch_data test, range() does not return a list in Python 3.x

bfeeny opened this issue · 1 comments

In the notebook there are some tests to test batch_data

# test dataloader

test_text = range(50)
t_loader = batch_data(test_text, sequence_length=5, batch_size=10)

data_iter = iter(t_loader)
sample_x, sample_y = data_iter.next()

print(sample_x.shape)
print(sample_x)
print()
print(sample_y.shape)
print(sample_y)

range(50) returns an object of type range not a list. This will trip students up. Code should be:

test_text = list(range(50))

Happy to review and approve a PR for this. Thanks for the suggestion!