Leonardo_Ma:

is batch_x in shape torch.Size([1, 500, 60, 2130])?


It will be shape torch.Size([batch_size, 500, 60, 2130]) where batch_size is specified in your dataloader.
And yes, you have to send it to the GPU manually at each batch (unless you want to load the entire thing in memory).



 Leonardo_Ma:

By the way, why doesn’t pytorch do like Keras, automatically load batches in RAM, and send single batch to GPU. Since GPU memory is the obvious bottleneck now, no one can use large dataset in GPU memory. Why would pytorch leave this to users?


I can’t really comment too much on the design decisions behind pytorch, but in my opinion there is more boilerplate code but this also gives you greater flexibility.