mindspore.dataset.Dataset.to_json

View Source On Gitee
Dataset.to_json(filename='')[source]

Serialize a pipeline into JSON string and dump into file if filename is provided.

Parameters

filename (str) – filename of JSON file to be saved as. Default: "".

Returns

str, JSON string of the pipeline.

Examples

>>> import mindspore.dataset as ds
>>> mnist_dataset_dir = "/path/to/mnist_dataset_directory"
>>> dataset = ds.MnistDataset(dataset_dir=mnist_dataset_dir)
>>> dataset_json = dataset.to_json("/path/to/mnist_dataset_pipeline.json")