class Classifier(nn.Module):
def __init__(self):
super(Classifier, self).__init__()
self.cnn = nn.Sequential(
nn.Conv1d(1, 64, 3, 1, 1),
nn.BatchNorm1d(64),
nn.ReLU(),
nn.MaxPool1d(2, 2, 0),
nn.Conv1d(64, 128, 3, 1, 1),
nn.BatchNorm1d(128),
nn.ReLU(),
nn.MaxPool1d(2, 2, 0),
nn.Conv1d(128, 256, 3, 1, 1),
nn.BatchNorm1d(256),
nn.ReLU(),
nn.MaxPool1d(2, 2, 0))
self.fc = nn.Sequential(
nn.Linear(7168, 1024),
nn.ReLU(),
nn.Linear(1024, 4))
def forward(self, x):
x = self.cnn(x)
x = out.view(out.size()[0], -1)
x = self.fc(x)
return x
创建一个简单的神经网络
最新推荐文章于 2024-03-10 10:51:48 发布