parameters: (self, enc_hiddens: torch.Tensor, source_lengths: List[int])
return_statement: return enc_masks.to(self.device)
docstring: Generate sentence masks for encoder hidden states.
  
          @param enc_hiddens (Tensor): encodings of shape (b, src_len, 2*h), where b = batch size,
                                       src_len = max source length, h = hidden size. 
          @param source_lengths (List[int]): List of actual lengths for each of the sentences in the batch.
          
          @returns enc_masks (Tensor): Tensor of sentence masks of shape (b, src_len),
                                      where src_len = max source length, h = hidden size.
docstring_summary: Generate sentence masks for encoder hidden states.
docstring_tokens: Generate sentence masks for encoder hidden states .
function: def generate_sent_masks(self, enc_hiddens: torch.Tensor, source_lengths: List[int]) -> torch.Tensor:
          """ Generate sentence masks for encoder hidden states.
  
          @param enc_hiddens (Tensor): encodings of shape (b, src_len, 2*h), where b = batch size,
                                       src_len = max source length, h = hidden size. 
          @param source_lengths (List[int]): List of actual lengths for each of the sentences in the batch.
          
          @returns enc_masks (Tensor): Tensor of sentence masks of shape (b, src_len),
                                      where src_len = max source length, h = hidden size.
          """
          enc_masks = torch.zeros(enc_hiddens.size(0), enc_hiddens.size(1), dtype=torch.float)
          for e_id, src_len in enumerate(source_lengths):
              enc_masks[e_id, src_len:] = 1
          return enc_masks.to(self.device)
function_tokens: def generate_sent_masks ( self , enc_hiddens : torch . Tensor , source_lengths : List [ int ] ) -> torch . Tensor : enc_masks = torch . zeros ( enc_hiddens . size ( 0 ) , enc_hiddens . size ( 1 ) , dtype = torch . float ) for e_id , src_len in enumerate ( source_lengths ) : enc_masks [ e_id , src_len : ] = 1 return enc_masks . to ( self . device )