Skip to content

Machine Learning

[已解決][PyTorch] AttributeError: 'tuple' object has no attribute 'size'

之前,我曾經寫過一篇文章敘述我如何印出我使用 PyTorch 搭建的模型架構,具體連結可以參考文末。但是開心了沒多久,過了一段時間後,當我又要使用這項工具來繪製另一個全新的模型架構準備報告的同時,我卻得到了以下這樣的報錯:

AttributeError: 'tuple' object has no attribute 'size'
Read More »[已解決][PyTorch] AttributeError: 'tuple' object has no attribute 'size'

[已解決] RuntimeError: Input and parameter tensors are not at the same device, found input tensor at cpu and parameter tensor at cuda:0

今天,我在使用 PyTorch 讀取一個已經訓練好的模型進行全新資料的分類時,意外地遇到了以下這個報錯:

RuntimeError: Input and parameter tensors are not at the same device, found input tensor at cuda:1 and parameter tensor at cuda:0
Read More »[已解決] RuntimeError: Input and parameter tensors are not at the same device, found input tensor at cpu and parameter tensor at cuda:0