code: def _apply_del_words(
      in_tokens,
      in_scores,
      in_attn,
      word_del_pred,
      padding_idx,
      bos_idx,
      eos_idx,
  ):
      # apply deletion to a tensor
      in_masks = in_tokens.ne(padding_idx)
      bos_eos_masks = in_tokens.eq(bos_idx) | in_tokens.eq(eos_idx)
  
      max_len = in_tokens.size(1)
      word_del_pred.masked_fill_(~in_masks, 1)
      word_del_pred.masked_fill_(bos_eos_masks, 0)
  
      reordering = (
          new_arange(in_tokens)
          .masked_fill_(word_del_pred, max_len)
          .sort(1)[1]
      )
  
      out_tokens = in_tokens.masked_fill(
          word_del_pred, padding_idx
      ).gather(1, reordering)
  
      out_scores = None
      if in_scores is not None:
          out_scores = in_scores.masked_fill(word_del_pred, 0).gather(
              1, reordering
          )
  
      out_attn = None
      if in_attn is not None:
          _mask = word_del_pred[:, :, None].expand_as(in_attn)
          _reordering = reordering[:, :, None].expand_as(in_attn)
          out_attn = in_attn.masked_fill(_mask, 0.0).gather(
              1, _reordering
          )
  
      return out_tokens, out_scores, out_attn
  
file_path: fairseq/fairseq/models/nat/levenshtein_utils.py
imports: import torch
  from fairseq.utils import new_arange
label_desc: Use image node_id 6 for calling a global function with example usage: _apply_del_words(in_tokens, in_scores, in_attn, word_del_pred, padding_idx, bos_idx, eos_idx) and returns: out_tokens,  out_scores,  out_attn