|
|
|
@@ -46,8 +46,8 @@ def serialize(dataset, json_filepath=""): |
|
|
|
>>> dataset = dataset.map(operation=one_hot_encode, input_column_names="label") |
|
|
|
>>> dataset = dataset.batch(batch_size=10, drop_remainder=True) |
|
|
|
>>> # serialize it to JSON file |
|
|
|
>>> ds.engine.serialize(dataset, json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> serialized_data = ds.engine.serialize(dataset) # serialize it to Python dict |
|
|
|
>>> ds.serialize(dataset, json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> serialized_data = ds.serialize(dataset) # serialize it to Python dict |
|
|
|
""" |
|
|
|
return dataset.to_json(json_filepath) |
|
|
|
|
|
|
|
@@ -75,11 +75,11 @@ def deserialize(input_dict=None, json_filepath=None): |
|
|
|
>>> dataset = dataset.map(operation=one_hot_encode, input_column_names="label") |
|
|
|
>>> dataset = dataset.batch(batch_size=10, drop_remainder=True) |
|
|
|
>>> # Use case 1: to/from JSON file |
|
|
|
>>> ds.engine.serialize(dataset, json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> dataset = ds.engine.deserialize(json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> ds.serialize(dataset, json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> dataset = ds.deserialize(json_filepath="/path/to/mnist_dataset_pipeline.json") |
|
|
|
>>> # Use case 2: to/from Python dictionary |
|
|
|
>>> serialized_data = ds.engine.serialize(dataset) |
|
|
|
>>> dataset = ds.engine.deserialize(input_dict=serialized_data) |
|
|
|
>>> serialized_data = ds.serialize(dataset) |
|
|
|
>>> dataset = ds.deserialize(input_dict=serialized_data) |
|
|
|
|
|
|
|
""" |
|
|
|
data = None |
|
|
|
|