code: def _validate_initializer_string(init):
      dir_f = dir(torch.nn.init)
      loss_fns = [d.lower() for d in dir_f]
      if isinstance(init, str):
          try:
              str_idx = loss_fns.index(init.lower())
          except:
              raise ValueError(
                  "Invalid loss string input - must match pytorch function."
              )
          return getattr(torch.nn.init, dir(torch.nn.init)[str_idx])
      elif callable(init):
          return init
      else:
          raise ValueError("Invalid loss input")
  
imports: from fnmatch import fnmatch
  import torch.nn.init
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_initializer_string(init) and returns: getattr, init