code: def test_pin_memory(self):
      sample_list = test_utils.build_random_sample_list()
      sample_list.pin_memory()
  
      pin_list = [sample_list.y, sample_list.z.y]
      non_pin_list = [sample_list.x, sample_list.z.x]
  
      all_pinned = True
  
      for pin in pin_list:
          all_pinned = all_pinned and pin.is_pinned()
  
      self.assertTrue(all_pinned)
  
      any_pinned = False
  
      for pin in non_pin_list:
          any_pinned = any_pinned or (
              hasattr(pin, "is_pinned") and pin.is_pinned()
          )
  
      self.assertFalse(any_pinned)
  
file_path: mmf/tests/common/test_sample.py
imports: import unittest
  import tests.test_utils
  import torch
  from mmf.common.sample import convert_batch_to_sample_list, Sample, SampleList, to_device
label_desc: Use image node_id 1 for calling the TestSampleList obj's underlying member method code with example usage: obj.test_pin_memory() without return types