code: def test_read_write_1(self):
      schema = {
          "tf": SizeData(dtype="float32", shape=(112, 112)),
          "ti": SizeData(dtype="int32", shape=(4, 64, 64)),
      }
      # generate data which corresponds to the schema
      data_elts = []
      torch.manual_seed(23)
      for _i in range(3):
          data_elt = {
              "tf": torch.rand((112, 112), dtype=torch.float32),
              "ti": (torch.rand(4, 64, 64) * 1000).to(
                  dtype=torch.int32
              ),
          }
          data_elts.append(data_elt)
      # WARNING: opens the file several times! may not work on all platforms
      with tempfile.NamedTemporaryFile() as hFile:
          storage = SingleProcessFileTensorStorage(
              schema, hFile.name, "wb"
          )
          # write data to the storage
          for i in range(3):
              record_id = storage.put(data_elts[i])
              self.assertEqual(record_id, i)
          hFile.seek(0)
          storage = SingleProcessFileTensorStorage(
              schema, hFile.name, "rb"
          )
          # read data from the storage
          for i in range(3):
              record = storage.get(i)
              self.assertEqual(len(record), len(schema))
              for field_name in schema:
                  self.assertTrue(field_name in record)
                  self.assertEqual(
                      data_elts[i][field_name].shape,
                      record[field_name].shape,
                  )
                  self.assertEqual(
                      data_elts[i][field_name].dtype,
                      record[field_name].dtype,
                  )
                  self.assertTrue(
                      torch.allclose(
                          data_elts[i][field_name], record[field_name]
                      )
                  )
  
imports: import io
  import tempfile
  import unittest
  from contextlib import ExitStack
  import torch
  import torch.distributed
  import torch.multiprocessing
  from detectron2.utils import comm
  from densepose.evaluation.tensor_storage import SingleProcessFileTensorStorage, SingleProcessRamTensorStorage, SizeData, storage_gather
label_desc: Use image node_id 1 for calling the TestSingleProcessFileTensorStorage obj's underlying member method code with example usage: obj.test_read_write_1() without return types