This is the error message I get for 64 batch size.
trainloader = torch.utils.data.DataLoader(trainset, batch_size=64,num_workers=0,
                                          shuffle=True)

RuntimeError: CUDA out of memory. Tried to allocate 98.00 MiB (GPU 0; 4.00 GiB total capacity; 2.76 GiB already allocated; 72.80 MiB free; 67.93 MiB cached)


and this is for 16 batch size
RuntimeError: CUDA out of memory. Tried to allocate 50.00 MiB (GPU 0; 4.00 GiB total capacity; 2.82 GiB already allocated; 22.80 MiB free; 58.68 MiB cached)


only working for 8 batch size  and 0 worker