Pytorch Run Error: BrokenPipeError [How to Solve]

The problem occurs when doing machine learning training.

Reason for the error: The problem is due to multi-threading under windows, and is related to the DataLoader class. Just change the number of num_workers to 0. This is a bug in windows.

The error code can be referred to:,batch_size=Bach_Size,shuffle=True,num_workers=2),batch_size=Bach_Size,shuffle=True,num_workers=2)

Set The number of num_ workers to 0,batch_size=Bach_Size,shuffle=True,num_workers=0),batch_size=Bach_Size,shuffle=True,num_workers=0)

Read More: