code: def _get_mask(sampled, total):
      multihot = [
          i == sampled or (isinstance(sampled, list) and i in sampled)
          for i in range(total)
      ]
      return torch.tensor(multihot, dtype=torch.bool)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .None import register_nas_algo
  from .base import BaseNAS
  from ..space import BaseSpace
  from ..utils import AverageMeterGroup, replace_layer_choice, replace_input_choice, get_module_order, sort_replaced_module, PathSamplingInputChoice, PathSamplingLayerChoice
  from nni.nas.pytorch.fixed import apply_fixed_architecture
  from tqdm import tqdm
  from datetime import datetime
  import numpy
  from ....utils import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: _get_mask(sampled, total) and returns: torch