class_docstr: DatasetBuilder for rlu_rwrl dataset.
class_docstr_tok: ["DatasetBuilder","for","rlu_rwrl","dataset","."]
code: def tf_example_to_step_ds(  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
      self, tf_example: tf.Tensor, feature_description
  ) -> Dict[str, Any]:
      data = tf.io.parse_single_example(tf_example, feature_description)
      data = tree_deflatten_with_delimiter(data)
  
      # Shift the action and the rewards to conform to a common format.
      # The last action and reward will be a placeholder value.
      action = tf.concat(
          (data["action"][1:], data["action"][:1]), axis=0
      )
      reward = tf.concat(
          (data["reward"][1:], data["reward"][:1]), axis=0
      )
      discount = tf.concat(
          (data["discount"][1:], data["discount"][:1]), axis=0
      )
      is_first = tf.concat(
          [[True], [False] * tf.ones(DEFAULT_NUM_TIMESTEPS - 1)], axis=0
      )
      is_last = tf.concat(
          [[False] * tf.ones(DEFAULT_NUM_TIMESTEPS - 1), [True]], axis=0
      )
      is_terminal = tf.squeeze(discount == 0.0, axis=-1)
      episode_return = tf.reduce_sum(reward)
      episode = {
          # Episode Metadata
          "episode_return": episode_return,
          "steps": {
              "observation": data["observation"],
              "action": action,
              "reward": reward,
              "discount": discount,
              "is_first": is_first,
              "is_last": is_last,
              "is_terminal": is_terminal,
          },
      }
      return episode
  
imports: from __future__ import annotations
  import collections
  import dataclasses
  import functools
  import os
  from typing import Any, Dict, Generator, Optional, Sequence, Text, Tuple, Union
  import numpy
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
  from tensorflow_datasets.rl_unplugged import rlu_common
label_desc: Use image node_id 6 for calling the RluRwrl obj's underlying member method code with example usage: obj.tf_example_to_step_ds(tf_example, feature_description) and returns: episode