src/rime/models/transformer.py
def forward(self, batch):
        """ output user embedding at lengths-1 positions """
        TN_inp, lengths = batch
        mask = self.model._generate_square_subsequent_mask(len(TN_inp)).to(TN_inp.device)

        TNC_enc = self.model.encoder(TN_inp) * np.sqrt(self.model.ninp)
        TNC_enc = self.model.pos_encoder(TNC_enc)
        TNC_out = self.model.transformer_encoder(TNC_enc, mask)
        return self._decode_last(TNC_out, lengths)
 output user embedding at lengths-1 positions 
output user embedding at lengths-1 positions
output user embedding at lengths - 1 positions
def forward(self, batch):
        TN_inp, lengths = batch
        mask = self.model._generate_square_subsequent_mask(len(TN_inp)).to(TN_inp.device)
        TNC_enc = self.model.encoder(TN_inp) * np.sqrt(self.model.ninp)
        TNC_enc = self.model.pos_encoder(TNC_enc)
        TNC_out = self.model.transformer_encoder(TNC_enc, mask)
        return self._decode_last(TNC_out, lengths)
def forward ( self , batch ) : TN_inp , lengths = batch mask = self . model . _generate_square_subsequent_mask ( len ( TN_inp ) ) . to ( TN_inp . device ) TNC_enc = self . model . encoder ( TN_inp ) * np . sqrt ( self . model . ninp ) TNC_enc = self . model . pos_encoder ( TNC_enc ) TNC_out = self . model . transformer_encoder ( TNC_enc , mask ) return self . _decode_last ( TNC_out , lengths )
output user embedding at lengths-1 positions
output user embedding at lengths - 1 positions
""" output user embedding at lengths-1 positions """
self
batch