original_docstring: 
      Create a mask to hide padding and future words.
      This utility function adds padding mask and attention mask together
      @param target_padded (Tensor): (batch_size, sentence_length)
      
docstring: Create a mask to hide padding and future words.
  This utility function adds padding mask and attention mask together
  @param target_padded (Tensor): (batch_size, sentence_length)
docstring_tokens: Create a mask to hide padding and future words . This utility function adds padding mask and attention mask together @param target_padded ( Tensor ) : ( batch_size sentence_length )
code: def generate_tgt_masks(target_padded, pad):
      '''
      Create a mask to hide padding and future words.
      This utility function adds padding mask and attention mask together
      @param target_padded (Tensor): (batch_size, sentence_length)
      '''
  
      target_msk = (target_padded != pad).unsqueeze(-2)
      size = target_padded.size(1) # get seq_len for matrix
  
      #nopeak_mask = np.triu(np.ones((1, size, size)), k=1).astype('uint8')
      nopeak_mask = torch.triu(torch.ones(size, size), 1)
      if torch.cuda.is_available():
          # Uncomment this if training in GPU is available
          nopeak_mask = torch.autograd.Variable(nopeak_mask == 0).cuda()
      else:
          # Uncomment this if training is in CPU only
          nopeak_mask = torch.autograd.Variable(nopeak_mask == 0)
  
      target_mask = target_msk & nopeak_mask
      return target_mask
code_tokens: def generate_tgt_masks ( target_padded , pad ) : target_msk = ( target_padded != pad ) . unsqueeze ( - 2 ) size = target_padded . size ( 1 ) nopeak_mask = torch . triu ( torch . ones ( size , size ) , 1 ) if torch . cuda . is_available ( ) : nopeak_mask = torch . autograd . Variable ( nopeak_mask == 0 ) . cuda ( ) else : nopeak_mask = torch . autograd . Variable ( nopeak_mask == 0 ) target_mask = target_msk & nopeak_mask return target_mask
short_docstring: Create a mask to hide padding and future words.
short_docstring_tokens: Create a mask to hide padding and future words .
comment: '''
      Create a mask to hide padding and future words.
      This utility function adds padding mask and attention mask together
      @param target_padded (Tensor): (batch_size, sentence_length)
      '''$SEP$# get seq_len for matrix$SEP$#nopeak_mask = np.triu(np.ones((1, size, size)), k=1).astype('uint8')$SEP$# Uncomment this if training in GPU is available$SEP$# Uncomment this if training is in CPU only