code: def test_traverse_doesnt_ignore_intermediate_collections(
      self,
  ) -> None:
      state_dict: STATE_DICT_TYPE = {
          "key0": [{"key1": {"key2": torch.tensor([1])}}]
      }
  
      data = {}
  
      def collect_data(path, value):
          nonlocal data
          data[path] = value
  
      _traverse.traverse_state_dict(state_dict, collect_data)
  
      self.assertIn(("key0", 0, "key1", "key2"), data)
      self.assertEqual(
          data[("key0", 0, "key1", "key2")],
          torch.tensor([1]),
      )
  
file_path: pytorch/test/distributed/checkpoint/test_traverse.py
imports: from collections import OrderedDict
  import torch
  import torch.distributed.checkpoint._traverse
  from torch.distributed.checkpoint.metadata import STATE_DICT_TYPE
  from torch.testing._internal.common_utils import run_tests, TestCase
label_desc: Use image node_id 4 for calling the TestTraverse obj's underlying member method code with example usage: obj.test_traverse_doesnt_ignore_intermediate_collections() without return types