def filepattern(self, data_dir, mode, shard=None):
    """Get filepattern for data files for mode.

    Args:
      data_dir: str, data directory.
      mode: DatasetSplit
      shard: int, if provided, will only read data from the specified shard.

    Returns:
      filepattern str
    """
    path = os.path.join(data_dir, self.dataset_filename())
    if shard is not None:
      shard_str = "%05d" % shard
    elif mode == problem.DatasetSplit.TRAIN:
      # Use the first 90 shards.
      shard_str = "000[0-8]"
    else:
      assert mode in [problem.DatasetSplit.EVAL,
                      tf_estimator.ModeKeys.PREDICT,
                      problem.DatasetSplit.TEST]
      # Use the last 10 shards.
      shard_str = "0009"

    return "%s-%s*" % (path, shard_str)
Get filepattern for data files for mode.

    Args:
      data_dir: str, data directory.
      mode: DatasetSplit
      shard: int, if provided, will only read data from the specified shard.

    Returns:
      filepattern str
    
tensor2tensor/data_generators/celebahq.py