def count_tf_records(file_path):
  """Counts the number of records in a GZIP'd TFRecord file."""
  gzip_option = tf.python_io.TFRecordOptions(
      tf.python_io.TFRecordCompressionType.GZIP)
  count = 0
  for _ in tf.python_io.tf_record_iterator(file_path, gzip_option):
    count += 1
  return count
Counts the number of records in a GZIP'd TFRecord file.
language/realm/retrieval.py