code: def extract_mask(mask, token):
      mask_ret = torch.zeros(*(mask.shape)).to(mask.device)
      mask_ret.fill_(0)
      mask_ret[mask == token] = 1
      return mask_ret
  
file_path: graph4nlp/graph4nlp/pytorch/modules/prediction/generation/StdRNNDecoder.py
imports: import random
  from functools import reduce
  import torch
  import torch.nn
  from graph4nlp.pytorch.modules.prediction.generation.attention import Attention
  from graph4nlp.pytorch.modules.prediction.generation.base import RNNDecoderBase
  from graph4nlp.pytorch.modules.utils.vocab_utils import Vocab
label_desc: Use image node_id 1 for calling a global function with example usage: extract_mask(mask, token) and returns: mask_ret