code: def _check_simple_reader(loader, expected_data, expected_fields):
      # Read a bunch of entries from the dataset and compare the data to reference
      def _type(v):
          return v.dtype if isinstance(v, np.ndarray) else type(v)
  
      def _unbatch(x):
          if isinstance(x, torch.Tensor):
              x_numpy = x.numpy()
              assert x_numpy.shape[0] == 1
              return x_numpy.squeeze(0)
          elif isinstance(x, list):
              return x[0]
          else:
              raise RuntimeError("Unexpected type while unbatching.")
  
      expected_field_names = [f.name for f in expected_fields]
      for actual in loader:
          actual_numpy = {
              k: _unbatch(v)
              for k, v in actual.items()
              if k in expected_field_names
          }
          expected_all_fields = next(
              d for d in expected_data if d["id"] == actual_numpy["id"]
          )
          expected = {
              k: v
              for k, v in expected_all_fields.items()
              if k in expected_field_names
          }
          np.testing.assert_equal(actual_numpy, expected)
          actual_types = [_type(v) for v in actual_numpy.values()]
          expected_types = [_type(v) for v in actual_numpy.values()]
          assert actual_types == expected_types
  
imports: from decimal import Decimal
  from packaging import version
  import numpy
  import pyarrow
  import pytest
  import torch
  from petastorm import make_reader, TransformSpec, make_batch_reader
  from petastorm.pytorch import _sanitize_pytorch_types, DataLoader, BatchedDataLoader, decimal_friendly_collate, InMemBatchedDataLoader, _load_rows_into_mem
  from petastorm.tests.test_common import TestSchema
label_desc: Use image node_id 1 for calling a global function with example usage: _check_simple_reader(loader, expected_data, expected_fields) and returns: unknown, x_numpy, x