code: def random_rollout_subsequences(
      rollouts, num_subsequences, subsequence_length
  ):
      """Chooses a random frame sequence of given length from a set of rollouts."""
  
      def choose_subsequence():
          # TODO(koz4k): Weigh rollouts by their lengths so sampling is uniform over
          # frames and not rollouts.
          rollout = random.choice(rollouts)
          try:
              from_index = random.randrange(
                  len(rollout) - subsequence_length + 1
              )
          except ValueError:
              # Rollout too short; repeat.
              return choose_subsequence()
          return rollout[from_index : (from_index + subsequence_length)]
  
      return [choose_subsequence() for _ in range(num_subsequences)]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import datetime
  import math
  import os
  import pprint
  import random
  import time
  import six
  from tensor2tensor.bin import t2t_trainer
  from tensor2tensor.models.research import rl
  from tensor2tensor.rl import rl_utils
  from tensor2tensor.rl import trainer_model_based_params
  from tensor2tensor.rl.dopamine_connector import DQNLearner
  from tensor2tensor.rl.restarter import Restarter
  from tensor2tensor.utils import trainer_lib
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling a global function with example usage: random_rollout_subsequences(rollouts, num_subsequences, subsequence_length) and returns: unknown, rollout, choose_subsequence