code: def check_equal_structures(a: typing.Any, b: typing.Any) -> None:
      """
      Check that two objects, consisting of any nested structures of lists and
      dicts, with leaf values of tensors or built-in objects, are equal in
      structure and values.
      """
      if isinstance(a, dict):
          assert isinstance(b, dict)
          assert len(a) == len(b)
          for key in a:
              assert key in b
              check_equal_structures(a[key], b[key])
      elif isinstance(a, list):
          assert isinstance(b, list)
          assert len(a) == len(b)
          for x, y in zip(a, b):
              check_equal_structures(x, y)
      elif isinstance(a, torch.Tensor):
          assert isinstance(b, torch.Tensor)
          assert torch.allclose(a, b)
      else:
          assert a == b
  
imports: import contextlib
  import importlib
  import io
  import os
  import pathlib
  import sys
  import typing
  from unittest import mock
  import numpy
  import pytest
  import torch
  from _pytest import monkeypatch
  from torch.distributed import launcher
  import determined
  from determined import pytorch
  from tests.experiment import pytorch_utils, utils
  from tests.experiment.fixtures import pytorch_onevar_model
label_desc: Use image node_id 1 for calling a global function with example usage: check_equal_structures(a, b) without return types