Thank you for the script! Before I learned about the DataLoader object and the iterables, I wrote my own Batch Generator. The one you provided is great and I wanted to share my version for the last bit where you create the Batch feature tensor.
features = torch.zeros((len(data), max_len, n_ftrs)) for idx,value in enumerate(data): features[idx,:value.shape,:] = torch.tensor(val)
I guess this one is a little faster.