TypeError: empty() received an invalid combination of arguments

填一个小坑

构建网络卷积层时,报错:TypeError: empty() received an invalid combination of arguments - got (tuple, dtype=NoneType, device=NoneType), but expected one of:

报错代码

        self.adaptivechannel=int(self.channels/2) #代码未转换类型
        self.conv_forAdaptive=nn.Conv2d(self.channels,self.adaptivechannel,1,1,0)

报错原因:

卷积通道数需为整型,整数相除为浮点型。

你可能感兴趣的:(深度学习填坑记录,深度学习,python,人工智能)