in spotify_tensorflow/scripts/tfr_read.py [0:0]
def tfr_read_to_json(tf_records_paths, schema_path=None):
if schema_path is not None:
assert file_io.file_exists(schema_path), "File not found: {}".format(schema_path)
for tf_record_file, schema in list_tf_records(tf_records_paths, schema_path):
assert file_io.file_exists(tf_record_file), "File not found: {}".format(tf_record_file)
decoder = get_decoder_from_schema(schema)
for record in tf.python_io.tf_record_iterator(tf_record_file):
yield decoder.to_json(record)