Skip to content

Instantly share code, notes, and snippets.

@vidit0210
Created February 25, 2020 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vidit0210/eb5ac2fc97cc1e4c8129eea0701188f1 to your computer and use it in GitHub Desktop.
Save vidit0210/eb5ac2fc97cc1e4c8129eea0701188f1 to your computer and use it in GitHub Desktop.
def write_recordio_file (filename, x, y=None):
with open(filename, 'wb') as f:
smac.write_numpy_to_dense_tensor(f, x, y)
def read_recordio_file (filename, recordsToPrint = 10):
with open(filename, 'rb') as f:
record = smac.read_records(f)
for i, r in enumerate(record):
if i >= recordsToPrint:
break
print ("record: {}".format(i))
print(r)
write_recordio_file('demo_file.recordio',X,y)
read_recordio_file('demo_file.recordio',3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment