code: def test_serialization():
      """Test super serial saving and loading.
      NOTE- test will only work in eager mode due to list() dataset cast.
      """
      savefolder = tempfile.TemporaryDirectory()
      savepath = os.path.join(savefolder.name, "temp_dataset")
      tfrecord_path = savepath + ".tfrecord"
      header_path = savepath + ".header"
  
      # Data
      x = np.linspace(1, 3000, num=3000).reshape(10, 10, 10, 3)
      y = np.linspace(1, 10, num=10).astype(int)
      ds = tf.data.Dataset.from_tensor_slices({"image": x, "label": y})
  
      # Run
      tfio.experimental.serialization.save_dataset(
          ds, tfrecord_path=tfrecord_path, header_path=header_path
      )
      new_ds = tfio.experimental.serialization.load_dataset(
          tfrecord_path=tfrecord_path, header_path=header_path
      )
  
      # Test that values were saved and restored
      assert (
          list(ds)[0]["image"].numpy()[0, 0, 0]
          == list(new_ds)[0]["image"].numpy()[0, 0, 0]
      )
      assert list(ds)[0]["label"] == list(new_ds)[0]["label"]
  
      assert (
          list(ds)[-1]["image"].numpy()[0, 0, 0]
          == list(new_ds)[-1]["image"].numpy()[0, 0, 0]
      )
      assert list(ds)[-1]["label"] == list(new_ds)[-1]["label"]
  
      # Clean up- folder will disappear on crash as well.
      savefolder.cleanup()
  
file_path: io/tests/test_serial_ops.py
imports: import os
  import tempfile
  import numpy
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 1 for calling a global function with example usage: test_serialization() without return types