code: def _check_param(param, x, name):
      if isinstance(param, (bool, int, float)):
          new_param = param * torch.ones_like(x)
      elif isinstance(param, (np.ndarray, list)):
          if param.ndim != x.ndim:
              raise ValueError(
                  f"Mismatched number of dimensions for {name}."
                  "  Expand dimensions to match input."
              )
          new_param = torch.FloatTensor(param).to(x.device)  # type: ignore
      elif isinstance(param, torch.Tensor):
          if param.ndim != x.ndim:
              raise ValueError(
                  f"Mismatched number of dimensions for {name}."
                  "  Expand dimensions to match input."
              )
          new_param = param.to(x.device)  # type: ignore
      else:
          raise ValueError(f"Unknown format for {name}")
  
      return new_param
  
file_path: advertorch/advertorch/attacks/blackbox/utils.py
imports: from math import inf
  from operator import mul
  from functools import reduce
  import numpy
  import torch
  from advertorch.utils import batch_clamp
label_desc: Use image node_id 2 for calling a global function with example usage: _check_param(param, x, name) and returns: new_param