def forward(self, x):
# x is (batch, len, d)
x = x.unsqueeze(1) # (batch, Ci, len, d)
x = [F.relu(conv(x)).squeeze(3) for conv in self.convs1] #[(batch, Co, len), ...]
x = [F.max_pool1d(i, i.size(2)).squeeze(2) for i in x] #[(N,Co), ...]
x = torch.cat(x, 1)
return x
评论列表
文章目录