Created
February 25, 2020 06:13
-
-
Save vidit0210/eb5ac2fc97cc1e4c8129eea0701188f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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