【发布时间】:2020-12-02 15:56:46
【问题描述】:
我是 PyTorch 的新手,我不断收到错误 mat1 dim1 must match mat1 dim0
这是我的网络代码
class Net(Module):
def __init__(self):
super(Net, self).__init__()
self.cnn_layers = Sequential(
Conv1d(4,4,kernel_size=2, stride=1, padding=1),
BatchNorm1d(4),
ReLU(inplace=True),
MaxPool1d(kernel_size=2,stride=1),
)
self.linear_layers = Sequential(
Linear(8267*4,2)
)
def forward(self, x):
print(x.shape)
x = self.cnn_layers(x)
print(x.shape)
x = self.linear_layers(x)
return x
以及打印语句的位置:
torch.Size([8267, 4, 1])
torch.Size([8267, 4, 1])
有什么帮助/建议吗?
【问题讨论】:
标签: python pytorch conv-neural-network