for i, cnn_layer in enumerate(self.cnn_layers):
// Pad so that the CNN doesn"t have the future
// of the sequence in its receptive field.
x = F.pad(x, (0, 0, self.kernel_width - min(i, 1), 0))
x = F.relu(cnn_layer(x))
x = x.squeeze(3)
After Change
.unsqueeze(3))
receptive_field_width = (self.kernel_width +
(self.kernel_width - 1) *
(self.dilation - 1))
// Pad so that the CNN doesn"t have the future
// of the sequence in its receptive field.
x = F.pad(sequence_embeddings,
(0, 0, receptive_field_width, 0))
x = F.tanh(self.cnn_layers[0](x))
for cnn_layer in self.cnn_layers[1:]:
x = F.pad(x, (0, 0, receptive_field_width - 1, 0))
x = F.tanh(cnn_layer(x))
x = x.squeeze(3)