class_docstr: Represents a variable-length list of items from spaces.Repeated.
  
  RepeatedValues are created when you use spaces.Repeated, and are
  accessible as part of input_dict["obs"] in ModelV2 forward functions.
  
  Example:
      Suppose the gym space definition was:
          Repeated(Repeated(Box(K), N), M)
  
      Then in the model forward function, input_dict["obs"] is of type:
          RepeatedValues(RepeatedValues(<Tensor shape=(B, M, N, K)>))
  
      The tensor is accessible via:
          input_dict["obs"].values.values
  
      And the actual data lengths via:
          # outer repetition, shape [B], range [0, M]
          input_dict["obs"].lengths
              -and-
          # inner repetition, shape [B, M], range [0, N]
          input_dict["obs"].values.lengths
  
  Attributes:
      values: The padded data tensor of shape [B, max_len, ..., sz],
          where B is the batch dimension, max_len is the max length of this
          list, followed by any number of sub list max lens, followed by the
          actual data size.
      lengths (List[int]): Tensor of shape [B, ...] that represents the
          number of valid items in each list. When the list is nested within
          other lists, there will be extra dimensions for the parent list
          max lens.
      max_len: The max number of items allowed in each list.
  
  TODO(ekl): support conversion to tf.RaggedTensor.
docstr: Unbatch both the repeat and batch dimensions into Python lists.
  
  This is only supported in PyTorch / TF eager mode.
  
  This lets you view the data unbatched in its original form, but is
  not efficient for processing.
  
  .. testcode::
      :skipif: True
  
      batch = RepeatedValues(<Tensor shape=(B, N, K)>)
      items = batch.unbatch_all()
      print(len(items) == B)
  
  .. testoutput::
  
      True
  
  .. testcode::
      :skipif: True
  
      print(max(len(x) for x in items) <= N)
  
  .. testoutput::
  
      True
  
  .. testcode::
      :skipif: True
  
      print(items)
  
  .. testoutput::
  
      [[<Tensor_1 shape=(K)>, ..., <Tensor_N, shape=(K)>],
       ...
       [<Tensor_1 shape=(K)>, <Tensor_2 shape=(K)>],
       ...
       [<Tensor_1 shape=(K)>],
       ...
       [<Tensor_1 shape=(K)>, ..., <Tensor_N shape=(K)>]]
code: def unbatch_all(self) -> List[List[TensorType]]:
      """Unbatch both the repeat and batch dimensions into Python lists.
  
      This is only supported in PyTorch / TF eager mode.
  
      This lets you view the data unbatched in its original form, but is
      not efficient for processing.
  
      .. testcode::
          :skipif: True
  
          batch = RepeatedValues(<Tensor shape=(B, N, K)>)
          items = batch.unbatch_all()
          print(len(items) == B)
  
      .. testoutput::
  
          True
  
      .. testcode::
          :skipif: True
  
          print(max(len(x) for x in items) <= N)
  
      .. testoutput::
  
          True
  
      .. testcode::
          :skipif: True
  
          print(items)
  
      .. testoutput::
  
          [[<Tensor_1 shape=(K)>, ..., <Tensor_N, shape=(K)>],
           ...
           [<Tensor_1 shape=(K)>, <Tensor_2 shape=(K)>],
           ...
           [<Tensor_1 shape=(K)>],
           ...
           [<Tensor_1 shape=(K)>, ..., <Tensor_N shape=(K)>]]
      """
  
      if self._unbatched_repr is None:
          B = _get_batch_dim_helper(self.values)
          if B is None:
              raise ValueError(
                  "Cannot call unbatch_all() when batch_dim is unknown. "
                  "This is probably because you are using TF graph mode."
              )
          else:
              B = int(B)
          slices = self.unbatch_repeat_dim()
          result = []
          for i in range(B):
              if hasattr(self.lengths[i], "item"):
                  dynamic_len = int(self.lengths[i].item())
              else:
                  dynamic_len = int(self.lengths[i].numpy())
              dynamic_slice = []
              for j in range(dynamic_len):
                  dynamic_slice.append(
                      _batch_index_helper(slices, i, j)
                  )
              result.append(dynamic_slice)
          self._unbatched_repr = result
  
      return self._unbatched_repr
  
file_path: ray/python/ray/rllib/models/repeated_values.py
imports: from typing import List
  from ray.rllib.utils.annotations import PublicAPI
  from ray.rllib.utils.typing import TensorType, TensorStructType
label_desc: Use image node_id 2 for calling the RepeatedValues obj's underlying member method code with example usage: obj.unbatch_all() and returns: self