Jianying_Hao:

But when I use GPU to train. The batch size can only be set to 4. If I use larger batch size, there will be error ‘Out of membery.’ I seems only one cpu is used


The GPU crashes when its RAM is full, unlike CPU which its memory management is made by the operating system (for example). there is not much to do with your batch_size. What you can do is to increase your number of workers, that would collaborate more CPUs.