def count_records(file_list, stop_at=None):
    'Counts number of records in files from `file_list` up to `stop_at`.\n\n  Args:\n    file_list: List of TFRecord files to count records in.\n    stop_at: Optional number of records to stop counting at.\n\n  Returns:\n    Integer number of records in files from `file_list` up to `stop_at`.\n  '
    num_records = 0
    for tfrecord_file in file_list:
        tf.logging.info('Counting records in %s.', tfrecord_file)
        for _ in tf.python_io.tf_record_iterator(tfrecord_file):
            num_records += 1
            if (stop_at and (num_records >= stop_at)):
                tf.logging.info('Number of records is at least %d.', num_records)
                return num_records
    tf.logging.info('Total records: %d', num_records)
    return num_records
Counts number of records in files from `file_list` up to `stop_at`.

Args:
  file_list: List of TFRecord files to count records in.
  stop_at: Optional number of records to stop counting at.

Returns:
  Integer number of records in files from `file_list` up to `stop_at`.
def count_records(file_list, stop_at=None):
    'Counts number of records in files from `file_list` up to `stop_at`.\n\n  Args:\n    file_list: List of TFRecord files to count records in.\n    stop_at: Optional number of records to stop counting at.\n\n  Returns:\n    Integer number of records in files from `file_list` up to `stop_at`.\n  '
    num_records = 0
    for tfrecord_file in file_list:
        tf.logging.info('Counting records in %s.', tfrecord_file)
        for _ in tf.python_io.tf_record_iterator(tfrecord_file):
            num_records += 1
            if (stop_at and (num_records >= stop_at)):
                tf.logging.info('Number of records is at least %d.', num_records)
                return num_records
    tf.logging.info('Total records: %d', num_records)
    return num_records