写一个小波卷积神经网络代码
时间: 2023-03-07 19:52:13 浏览: 153
卷积神经网络代码
4星 · 用户满意度95%
答案:import torch
from torch.nn import Conv1d, MaxPool1d class smallWaveletConvNet(nn.Module):
def __init__(self):
super(smallWaveletConvNet, self).__init__()
self.conv1 = Conv1d(1, 32, 5, padding=2)
self.pool1 = MaxPool1d(2)
self.conv2 = Conv1d(32, 64, 5, padding=2)
self.pool2 = MaxPool1d(2) def forward(self, x):
x = self.pool1(F.relu(self.conv1(x)))
x = self.pool2(F.relu(self.conv2(x)))
return x
阅读全文