code: def test_openexr_io_tensor():
      """Test case for OpenEXRIOTensor"""
      # image from http://gl.ict.usc.edu/Data/HighResProbes/
      filename = os.path.join(
          os.path.dirname(os.path.abspath(__file__)),
          "test_image",
          "glacier.exr",
      )
  
      (
          exr_shape,
          exr_dtype,
          exr_channel,
      ) = tfio.experimental.image.decode_exr_info(
          tf.io.read_file(filename)
      )
      assert np.all(exr_shape == [1024, 2048])
      assert np.all(
          exr_dtype.numpy() == [tf.float16, tf.float16, tf.float16]
      )
      assert np.all(exr_channel == ["B", "G", "R"])
  
      exr_0_b = tfio.experimental.image.decode_exr(
          tf.io.read_file(filename), 0, "B", tf.float16
      )
      exr_0_g = tfio.experimental.image.decode_exr(
          tf.io.read_file(filename), 0, "G", tf.float16
      )
      exr_0_r = tfio.experimental.image.decode_exr(
          tf.io.read_file(filename), 0, "R", tf.float16
      )
  
      exr = tfio.experimental.IOTensor.from_exr(filename)
      assert exr.keys == [0]
      assert exr(0).columns == ["B", "G", "R"]
  
      assert exr(0)("B").dtype == tf.float16
      assert exr(0)("G").dtype == tf.float16
      assert exr(0)("R").dtype == tf.float16
  
      assert exr(0)("B").shape == [1024, 2048]
      assert exr(0)("G").shape == [1024, 2048]
      assert exr(0)("R").shape == [1024, 2048]
  
      b = exr(0)("B").to_tensor()
      g = exr(0)("G").to_tensor()
      r = exr(0)("R").to_tensor()
  
      assert b.shape == [1024, 2048]
      assert g.shape == [1024, 2048]
      assert r.shape == [1024, 2048]
  
      assert b.dtype == tf.float16
      assert g.dtype == tf.float16
      assert r.dtype == tf.float16
  
      rgb = tf.stack([r, g, b], axis=2)
      rgb = tf.image.convert_image_dtype(rgb, tf.uint8)
      _ = tf.image.encode_png(rgb)
      # TODO: compare with generated png
      # tf.io.write_file('sample.png', png)
  
      assert np.all(b == exr_0_b)
      assert np.all(g == exr_0_g)
      assert np.all(r == exr_0_r)
  
imports: import os
  import numpy
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 8 for calling a global function with example usage: test_openexr_io_tensor() without return types