def get_tpu_bt_input_tensors(games,
                             games_nr,
                             batch_size,
                             feature_layout,
                             num_repeats=1,
                             number_of_games=500e3,
                             fresh_fraction=0.05,
                             random_rotation=True):
  dataset = bigtable_input.get_unparsed_moves_from_last_n_games(
      games, games_nr, number_of_games)
  dataset = dataset.repeat(num_repeats)
  dataset = dataset.batch(batch_size)
  dataset = dataset.filter(lambda t: tf.equal(tf.shape(t)[0], batch_size))
  dataset = dataset.map(
      functools.partial(batch_parse_tf_example, batch_size, feature_layout))
  if random_rotation:
    # Unbatch the dataset so we can rotate it
    dataset = dataset.apply(tf.data.experimental.unbatch())
    dataset = dataset.apply(
        tf.data.experimental.map_and_batch(
            functools.partial(_random_rotation, feature_layout),
            batch_size,
            drop_remainder=True))

  dataset = dataset.prefetch(tf.data.experimental.AUTOTUNE)
  return dataset