code: def index_to_mask(index, size):
      mask = torch.zeros(size, dtype=torch.bool, device=index.device)
      mask[index] = 1
      return mask
  
imports: import re
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: index_to_mask(index, size) and returns: mask