docstr: Returns a torch boolean about which elements should be masked out
docstr_tok: ["Returns","a","torch","boolean","about","which","elements","should","be","masked","out"]
code: def __mask(self, upos):
      """Returns a torch boolean about which elements should be masked out"""
  
      # creates all false mask
      mask = torch.zeros_like(upos, dtype=torch.bool)
  
      ### augmentation 1: punctuation augmentation ###
      # tags that needs to be checked, currently only PUNCT
      if random.uniform(0, 1) < self.augment_nopunct:
          for i in self.__punct_tags:
              # generate a mask for the last element
              last_element = torch.zeros_like(upos, dtype=torch.bool)
              last_element[..., -1] = True
              # we or the bitmask against the existing mask
              # if it satisfies, we remove the word by masking it
              # to true
              #
              # if your input is just a lone punctuation, we perform
              # no masking
              if not torch.all(upos.eq(torch.tensor([[i]]))):
                  mask |= (upos == i) & (last_element)
  
      return mask
  
imports: import random
  import logging
  import copy
  import torch
  from collections import namedtuple
  from torch.utils.data import DataLoader
  from torch.nn.utils.rnn import pad_sequence
  from stanza.models.common.bert_embedding import filter_data
  from stanza.models.common.data import map_to_ids, get_long_tensor, get_float_tensor, sort_all
  from stanza.models.common.vocab import PAD_ID, VOCAB_PREFIX, CharVocab
  from stanza.models.pos.vocab import WordVocab, XPOSVocab, FeatureVocab, MultiVocab
  from stanza.models.pos.xpos_vocab_factory import xpos_vocab_factory
  from stanza.models.common.doc import *
label_desc: Use image node_id 5 for calling the Dataset obj's underlying member method code with example usage: obj.__mask(upos) and returns: mask