(tfrecords_path)
return count
Returns the number of tf.Examples in a .tfrecords file.
Returns the number of tf.Examples in a .tfrecords file.
Returns the number of tf . Examples in a . tfrecords file .
def count_records(tfrecords_path):
  """Returns the number of tf.Examples in a .tfrecords file."""
  dataset = tf.data.TFRecordDataset(tfrecords_path)
  iterator = dataset.make_one_shot_iterator()
  next_element = iterator.get_next()
  count = 0
  with tf.Session() as sess:
    try:
      while True:
        sess.run(next_element)
        count += 1
    except tf.errors.OutOfRangeError:
      pass
  return count
def count_records ( tfrecords_path ) : dataset = tf . data . TFRecordDataset ( tfrecords_path ) iterator = dataset . make_one_shot_iterator ( ) next_element = iterator . get_next ( ) count = 0 with tf . Session ( ) as sess : try : while True : sess . run ( next_element ) count += 1 except tf . errors . OutOfRangeError : pass return count