当我尝试使用 pytorch 训练 CNN 模型时出现错误这是我创建的模型
该模型
import torch
class NNnet(torch.nn.Module):
def __init__(self, channels = 19, samples = 1000.0, outputs = 4):
super(NNnet, self).__init__()
#Sequential 1
self.seq1 = torch.nn.Sequential(
torch.nn.Conv2d(in_channels = 1, out_channels = 32, kernel_size = (1,20), stride = 1),
torch.nn.Conv2d(in_channels = 32, out_channels = 32, kernel_size = (3,1), stride = 1),
torch.nn.BatchNorm2d(32, eps = 0.001, momentum = 0.99),
torch.nn.ReLU(),
torch.nn.MaxPool2d(kernel_size = [1,5], stride = [1,2])
)
#calculate output of sample at each opeartion
samples = (samples - 20) + …Run Code Online (Sandbox Code Playgroud)