Spaces:
Sleeping
Sleeping
File size: 487 Bytes
4d0da28 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import pickle
import torch
def getExampleId(outFname_base, num_example):
return ("%s-%08d" % (outFname_base, num_example)).encode("UTF-8")
def serializeExample(price, graph):
price = torch.tensor(float(price), dtype=torch.float32)
one_data_serialized = pickle.dumps( {"graph": graph, "price" :price})
return one_data_serialized
def deserializeExample(exampleBytes):
example_dict = pickle.loads(exampleBytes)
return example_dict["graph"], example_dict["price"] |