class block(nn.Module): def __init__(self, in_channels, out_channels, identity_downsample=None, stride=1): super(block, self).__init__() self.out_channels, self.in_channels = out_channels, in_channels self.expansion = 1 self.conv1 = nn.Conv1d(self.in_channels, self.out_channels, kernel_size=15, stride=stride, padding=7) self.bn1 = nn.BatchNorm1d(self.out_channels) self.conv2 = nn.Conv1d(self.out_channels, self.out_channels*2, kernel_size=9, stride=1, padding=4) self.bn2 = nn.BatchNorm1d(self.out_channels*2) self.conv3 = nn.Conv1d(self.out_channels*2, self.out_channels*2, kernel_size=5, stride=1, padding=2) self.bn3 = nn.BatchNorm1d(self.out_channels*2) self.relu = nn.ReLU() self.identity_downsample = identity_downsample self.lin1 = nn.Linear(out_channels*2*250, 800) self.lin2 = nn.Linear(800, 40) self.lin3 = nn.Linear(40, 10) self.lin4 = nn.Linear(10, 2) def forward(self, x): identity = x x = self.conv1(x) x = self.bn1(x) x = self.relu(x) x = self.conv2(x) x = self.bn2(x) x = self.relu(x) x = self.conv3(x) x = self.bn3(x) if self.identity_downsample is not None: identity = self.identity_downsample(identity) x += identity return x