code: def _get_feature_parser(shape, dtype, compress_image=False):
      """Get tf.train.Features entry and decoder function for parsing feature.
  
      Args:
        shape: An array shape
        dtype: A list of dtypes.
        compress_image: Whether to decompress image. It is assumed that any uint8
          tensor of rank 3 with shape (w,h,c) is an image. If the tensor was
          compressed in the encoder, it needs to be decompressed.
  
      Returns:
        A tuple containing tf.io.FixedLenFeature decoder and decode function.
      """
      shape = _validate_shape(shape)
      dtype = _validate_dtype(dtype)
  
      if compress_image and len(shape) == 3 and dtype == tf.uint8:
          return (
              tf.io.FixedLenFeature(shape=[], dtype=tf.string),
              tf.io.decode_jpeg,
          )
  
      if dtype == tf.float32:
          return (
              tf.io.FixedLenFeature(shape=shape, dtype=tf.float32),
              lambda x: x,
          )
      elif dtype == tf.int64:
          return (
              tf.io.FixedLenFeature(shape=shape, dtype=tf.int64),
              lambda x: x,
          )
  
      def decode(x):
          return tf.reshape(tf.io.decode_raw(x, dtype), shape)
  
      return (tf.io.FixedLenFeature(shape=[], dtype=tf.string), decode)
  
file_path: agents/tf_agents/utils/example_encoding.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import abc
  import io
  import gin
  import numpy
  from PIL import Image
  import tensorflow
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 8 for calling a global function with example usage: _get_feature_parser(shape, dtype, compress_image) and returns: tf,  decode, tf,  tf, tf,  function, tf, tf,  function