docstr: Test add_time_dimension gives sequential data along the time dimension
docstr_tok: ["Test","add_time_dimension","gives","sequential","data","along","the","time","dimension"]
code: def test_add_time_dimension(self):
      """Test add_time_dimension gives sequential data along the time dimension"""
  
      B, T, F = np.random.choice(
          np.asarray(
              list(range(8, 32)), dtype=np.int32
          ),  # use int32 for seq_lens
          size=3,
          replace=False,
      )
  
      inputs_numpy = np.repeat(
          np.arange(B * T)[:, np.newaxis], repeats=F, axis=-1
      ).astype(np.int32)
      check(inputs_numpy.shape, (B * T, F))
      seq_lens = np.random.randint(1, T + 1, (B,))
  
      time_shift_diff_batch_major = np.ones(
          shape=(B, T - 1, F), dtype=np.int32
      )
      time_shift_diff_time_major = np.ones(
          shape=(T - 1, B, F), dtype=np.int32
      )
  
      if tf is not None:
          # Test tensorflow batch-major
          padded_inputs = tf.constant(inputs_numpy)
          batch_major_outputs = add_time_dimension(
              padded_inputs,
              seq_lens=seq_lens,
              framework="tf",
              time_major=False,
          )
          check(batch_major_outputs.shape.as_list(), [B, T, F])
          time_shift_diff = (
              batch_major_outputs[:, 1:] - batch_major_outputs[:, :-1]
          )
          check(time_shift_diff, time_shift_diff_batch_major)
  
      if torch is not None:
          # Test torch batch-major
          padded_inputs = torch.from_numpy(inputs_numpy)
          batch_major_outputs = add_time_dimension(
              padded_inputs,
              seq_lens=seq_lens,
              framework="torch",
              time_major=False,
          )
          check(batch_major_outputs.shape, (B, T, F))
          time_shift_diff = (
              batch_major_outputs[:, 1:] - batch_major_outputs[:, :-1]
          )
          check(time_shift_diff, time_shift_diff_batch_major)
  
          # Test torch time-major
          padded_inputs = torch.from_numpy(inputs_numpy)
          time_major_outputs = add_time_dimension(
              padded_inputs,
              seq_lens=seq_lens,
              framework="torch",
              time_major=True,
          )
          check(time_major_outputs.shape, (T, B, F))
          time_shift_diff = (
              time_major_outputs[1:] - time_major_outputs[:-1]
          )
          check(time_shift_diff, time_shift_diff_time_major)
  
file_path: ray/python/ray/rllib/policy/tests/test_rnn_sequencing.py
imports: import unittest
  import numpy
  import ray
  from ray.rllib.policy.rnn_sequencing import pad_batch_to_sequences_of_same_size, add_time_dimension, chop_into_sequences
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.view_requirement import ViewRequirement
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.test_utils import check
label_desc: Use image node_id 6 for calling the TestRNNSequencing obj's underlying member method code with example usage: obj.test_add_time_dimension() without return types