code: def test_string_field():
      dataset = CaptionDataset(100)
  
      with NamedTemporaryFile() as handle:
          writer = DatasetWriter(
              handle.name, {"label": StringField(MAX_STRING_SIZE)}
          )
  
          writer.from_indexed_dataset(dataset)
          loader = Loader(
              handle.name,
              batch_size=10,
              num_workers=2,
              order=OrderOption.RANDOM,
              pipelines={"label": [StringDecoder()]},
              custom_fields={"label": StringField},
          )
  
          all_caps = []
          for (x,) in loader:
              for cap in x:
                  all_caps.append(
                      cap.tobytes().decode("ascii").replace("\0", "")
                  )
          assert set(all_caps) == set(dataset.captions)
  
file_path: ffcv/tests/test_custom_field.py
imports: import pytest
  import numpy
  from uuid import uuid4
  from ffcv.fields.ndarray import NDArrayField, NDArrayDecoder
  from ffcv.writer import DatasetWriter
  from ffcv.loader import Loader, OrderOption
  from tempfile import NamedTemporaryFile
label_desc: Use image node_id 1 for calling a global function with example usage: test_string_field() without return types