使用Pytorch编写网络时,有时遇到 TypeError:‘tuple‘ object is not callable 错误。
bug原因:在编写网络时,因为习惯或者不注意在其中一层网络结尾时添加了逗号“,”。
如下所示:
class BlockA(nn.Module):
def __init__(self, in_channels, out_channels,downsample=None, stride=1):
super(BlockA, self).__init__()
self.conv1 = nn.Conv2d(in_channels