運行Pytorch tutorial代碼報錯:BrokenPipeError: [Errno 32] Broken pipe
該問題的產生是由於windows下多線程的問題,和DataLoader類有關,具體細節點這里Fix memory leak when using multiple workers on Windows
【解決方案】
修改調用torch.utils.data.DataLoader()函數時的 num_workers 參數。該參數官方API解釋如下:
num_workers (int, optional) – how many subprocesses to use for data loading. 0 means that the data will be loaded in the main process. (default: 0)
該參數是指在進行數據集加載時,啟用的線程數目。截止當前2018年5月9日11:15:52,如官方未解決該BUG,則可以通過修改num_works參數為 0 ,只啟用一個主進程加載數據集,避免在windows使用多線程即可。
【解釋參考】
https://blog.csdn.net/u014380165/article/details/79058479
感興趣掃一掃,備注:“人工智能”哦