nlpmodels/models/transformer.py
def _decode(self, memory: torch.Tensor, src_mask: torch.Tensor, tgt: torch.Tensor,
                tgt_mask: torch.Tensor) -> torch.Tensor:
        """
        Calculate all the layers in the decoder side of the model.
        Args:
            memory (torch.Tensor):
                matrix of (batch_size, max_seq_length, dim_model) size from encoder output.
            src_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking source so model doesn't see padding.
            tgt (torch.Tensor):
                matrix of (batch_size, max_seq_length) size of target sequence.
            tgt_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking target  Masking target so model
                doesn't see padding or next sequential values.

        Returns:
            encoder "memory" matrix of (batch_size, max_seq_length, dim_model) for decoder block.
        """
        embeddings = self._output_embeddings(tgt)
        pos_encoding = self._output_pe(embeddings)

        return self._decoder_block(pos_encoding, memory, src_mask, tgt_mask)

        Calculate all the layers in the decoder side of the model.
        Args:
            memory (torch.Tensor):
                matrix of (batch_size, max_seq_length, dim_model) size from encoder output.
            src_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking source so model doesn't see padding.
            tgt (torch.Tensor):
                matrix of (batch_size, max_seq_length) size of target sequence.
            tgt_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking target  Masking target so model
                doesn't see padding or next sequential values.

        Returns:
            encoder "memory" matrix of (batch_size, max_seq_length, dim_model) for decoder block.
        
Calculate all the layers in the decoder side of the model.
Calculate all the layers in the decoder side of the model .
def _decode(self, memory: torch.Tensor, src_mask: torch.Tensor, tgt: torch.Tensor,
                tgt_mask: torch.Tensor) -> torch.Tensor:
        embeddings = self._output_embeddings(tgt)
        pos_encoding = self._output_pe(embeddings)
        return self._decoder_block(pos_encoding, memory, src_mask, tgt_mask)
def _decode ( self , memory : torch . Tensor , src_mask : torch . Tensor , tgt : torch . Tensor , tgt_mask : torch . Tensor ) -> torch . Tensor : embeddings = self . _output_embeddings ( tgt ) pos_encoding = self . _output_pe ( embeddings ) return self . _decoder_block ( pos_encoding , memory , src_mask , tgt_mask )
Calculate all the layers in the decoder side of the model.
Calculate all the layers in the decoder side of the model .
"""
        Calculate all the layers in the decoder side of the model.
        Args:
            memory (torch.Tensor):
                matrix of (batch_size, max_seq_length, dim_model) size from encoder output.
            src_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking source so model doesn't see padding.
            tgt (torch.Tensor):
                matrix of (batch_size, max_seq_length) size of target sequence.
            tgt_mask (torch.Tensor):
                matrix of (batch_size, max_seq_length) masking target  Masking target so model
                doesn't see padding or next sequential values.

        Returns:
            encoder "memory" matrix of (batch_size, max_seq_length, dim_model) for decoder block.
        """
encoder "memory" matrix of (batch_size, max_seq_length, dim_model) for decoder block.
encoder " memory " matrix of ( batch_size max_seq_length dim_model ) for decoder block .
self
memory
torch.Tensor
matrix of (batch_size, max_seq_length, dim_model) size from encoder output.
matrix of ( batch_size max_seq_length dim_model ) size from encoder output .
src_mask
torch.Tensor
matrix of (batch_size, max_seq_length) masking source so model doesn't see padding.
matrix of ( batch_size max_seq_length ) masking source so model doesn ' t see padding .
tgt
torch.Tensor
matrix of (batch_size, max_seq_length) size of target sequence.
matrix of ( batch_size max_seq_length ) size of target sequence .
tgt_mask
torch.Tensor
matrix of (batch_size, max_seq_length) masking target  Masking target so model
doesn't see padding or next sequential values.
matrix of ( batch_size max_seq_length ) masking target Masking target so model doesn ' t see padding or next sequential values .