def inputs(num_devices, dataset_name, data_dir=None, input_name=None,
           num_chunks=0, append_targets=False):
  """Make Inputs for built-in datasets.

  Args:
    num_devices: how many devices to build the inputs for.
    dataset_name: a TFDS or T2T dataset name. If it's a T2T dataset name, prefix
      with "t2t_".
    data_dir: data directory.
    input_name: optional, name of the inputs from the dictionary.
    num_chunks: optional, into how many pieces should we chunk (large inputs).
    append_targets: optional, instead of inputs return a pair (inputs, targets)
      which is useful for autoregressive models.

  Returns:
    trax.inputs.Inputs
  """
  assert data_dir, "Must provide a data directory"
  data_dir = os.path.expanduser(data_dir)

  (train_batches, train_eval_batches, eval_batches,
   input_name, input_shape) = _train_and_eval_batches(
       dataset_name, data_dir, input_name, num_devices)

  def numpy_stream(dataset):
    return dataset_to_stream(
        dataset, input_name,
        num_chunks=num_chunks, append_targets=append_targets)

  if num_chunks > 0:
    length = input_shape[0]
    input_shape = tuple(
        [tuple([length // num_chunks] + list(input_shape)[1:])] * num_chunks)

  return Inputs(train_stream=lambda: numpy_stream(train_batches),
                train_eval_stream=lambda: numpy_stream(train_eval_batches),
                eval_stream=lambda: numpy_stream(eval_batches),
                input_shape=input_shape)
Make Inputs for built-in datasets.

  Args:
    num_devices: how many devices to build the inputs for.
    dataset_name: a TFDS or T2T dataset name. If it's a T2T dataset name, prefix
      with "t2t_".
    data_dir: data directory.
    input_name: optional, name of the inputs from the dictionary.
    num_chunks: optional, into how many pieces should we chunk (large inputs).
    append_targets: optional, instead of inputs return a pair (inputs, targets)
      which is useful for autoregressive models.

  Returns:
    trax.inputs.Inputs