日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > pytorch >内容正文

pytorch

【深度学习】empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=None

發布時間:2025/3/15 pytorch 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【深度学习】empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=None 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

構建yoloV3的resblock時,python的一個小坑

在構建一個簡單的卷積層時,出現如下的錯誤:

代碼如下:

class resblock(nn.Module):def __init__(self,inputDims):super(resblock,self).__init__()self.inputChannels = inputDimsself.middleChannels = int(inputDims/2)#報錯行self.conv1 = nn.Conv2d(in_channels=inputDims,out_channels=inputDims/2,kernel_size=1,stride=1)self.bn1 = nn.BatchNorm2d(self.middleChannels)self.active1 = nn.LeakyReLU()self.conv3x3 = nn.Conv2d(in_channels=self.middleChannels,out_channels=inputDims,kernel_size=3,stride=1,padding=1)self.bn2 = nn.BatchNorm2d(inputDims)self.active2 = nn.LeakyReLU()self.shortcut = shortCut()def forward(self,x):y1 = self.active1(self.bn1(self.conv1(x)))y = self.active2(self.bn2(self.conv3x3(y1)))return self.shortcut(x,y)

產生的原因是因為在python3中兩個整型相除得到的是浮點型,例如:4/2=2.0,而在構建卷積時的參數要求時整型

總結

以上是生活随笔為你收集整理的【深度学习】empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=None的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。