RuntimeError: Given groups=1, weight of size [32, 32, 1, 1], expected input[1, 64, 28, 28] to have 3

报错:RuntimeError: Given groups=1, weight of size [32, 32, 1, 1], expected input[1, 64, 28, 28] to have 32 channels, but got 64 channels instead

报此类错误是前后卷积层的通道不匹配,比如这里期望输入的通道是32,而上一层卷积传入的通道却是64,所以更改后面的输入通道即可

你可能感兴趣的:(pytorch报错,计算机视觉)