code: def has_nan(x):
      if isinstance(x, list) or isinstance(x, tuple):
          for xx in x:
              if torch.any(torch.isnan(xx)):
                  return True
          return False
      elif isinstance(x, dict):
          for k, v in x.items():
              if torch.any(torch.isnan(v)):
                  return True
      else:
          return torch.any(torch.isnan(x))
  
imports: import unittest
  import torch
  from torch.testing._internal import common_utils
  from apex.transformer.testing.distributed_test_base import NcclDistributedTestBase
label_desc: Use image node_id 3 for calling a global function with example usage: has_nan(x) and returns: False, torch, True, True