(self, src, lengths=None)
return hidden, output
See :obj:`onmt.encoders.encoder.EncoderBase.forward()`
See :obj:`onmt.encoders.encoder.EncoderBase.forward()`
See : obj : onmt . encoders . encoder . EncoderBase . forward ()
def forward(self, src, lengths=None):
        "See :obj:`onmt.encoders.encoder.EncoderBase.forward()`"
        # (batch_size, 1, nfft, t)
        # layer 1
        src = self.batch_norm1(self.layer1(src[:, :, :, :]))

        # (batch_size, 32, nfft/2, t/2)
        src = F.hardtanh(src, 0, 20, inplace=True)

        # (batch_size, 32, nfft/2/2, t/2)
        # layer 2
        src = self.batch_norm2(self.layer2(src))

        # (batch_size, 32, nfft/2/2, t/2)
        src = F.hardtanh(src, 0, 20, inplace=True)

        batch_size = src.size(0)
        length = src.size(3)
        src = src.view(batch_size, -1, length)
        src = src.transpose(0, 2).transpose(1, 2)

        output, hidden = self.rnn(src)

        return hidden, output
def forward ( self , src , lengths = None ) : # (batch_size, 1, nfft, t) # layer 1 src = self . batch_norm1 ( self . layer1 ( src [ : , : , : , : ] ) ) # (batch_size, 32, nfft/2, t/2) src = F . hardtanh ( src , 0 , 20 , inplace = True ) # (batch_size, 32, nfft/2/2, t/2) # layer 2 src = self . batch_norm2 ( self . layer2 ( src ) ) # (batch_size, 32, nfft/2/2, t/2) src = F . hardtanh ( src , 0 , 20 , inplace = True ) batch_size = src . size ( 0 ) length = src . size ( 3 ) src = src . view ( batch_size , - 1 , length ) src = src . transpose ( 0 , 2 ) . transpose ( 1 , 2 ) output , hidden = self . rnn ( src ) return hidden , output