技术栈
nn.conv2d卷积异常
客院载论
1 年前
pytorch
·
nn.conv2d卷积异常
pytorch异常——RuntimeError:Given groups=1, weight of size..., expected of...
nn.Conv2d 需要的输入张量格式为 (batch_size, channels, height, width),但您的示例输入张量 x 是 (batch_size, height, width, channels)。因此,需要对输入张量进行转置。