diff --git a/mindspore/mindrecord/filewriter.py b/mindspore/mindrecord/filewriter.py index c0a508e2717..af5b3d7345e 100644 --- a/mindspore/mindrecord/filewriter.py +++ b/mindspore/mindrecord/filewriter.py @@ -59,7 +59,7 @@ class FileWriter: ... "data": b"\xaf\xafU<\xb8|6\xbd}\xc1\x99[\xeaj+\x8f\x84\xd3\xcc\xa0,i\xbb\xb9-\xcdz\xecp{T\xb1"}] >>> writer = FileWriter(file_name="test.mindrecord", shard_num=1) >>> writer.add_schema(schema_json, "test_schema") - MSRStatus.SUCCESS + 0 >>> writer.add_index(indexes) MSRStatus.SUCCESS >>> writer.write_raw_data(data) @@ -100,7 +100,7 @@ class FileWriter: @classmethod def open_for_append(cls, file_name): - """ + r""" Open MindRecord file and get ready to append data. Args: @@ -116,6 +116,17 @@ class FileWriter: MRMOpenForAppendError: If failed to open file for appending data. Examples: + >>> from mindspore.mindrecord import FileWriter + >>> schema_json = {"file_name": {"type": "string"}, "label": {"type": "int32"}, "data": {"type": "bytes"}} + >>> data = [{"file_name": "1.jpg", "label": 0, + ... "data": b"\x10c\xb3w\xa8\xee$o&>> writer = FileWriter(file_name="test.mindrecord", shard_num=1) + >>> writer.add_schema(schema_json, "test_schema") + 0 + >>> writer.write_raw_data(data) + MSRStatus.SUCCESS + >>> writer.commit() + MSRStatus.SUCCESS >>> write_append = FileWriter.open_for_append("test.mindrecord") >>> write_append.write_raw_data(data) MSRStatus.SUCCESS @@ -317,7 +328,7 @@ class FileWriter: Examples: >>> from mindspore.mindrecord import FileWriter - >>> # define writer + >>> writer = FileWriter(file_name="test.mindrecord", shard_num=1) >>> writer.set_header_size(1 << 25) # 32MB MSRStatus.SUCCESS """ @@ -343,7 +354,7 @@ class FileWriter: Examples: >>> from mindspore.mindrecord import FileWriter - >>> # define writer + >>> writer = FileWriter(file_name="test.mindrecord", shard_num=1) >>> writer.set_page_size(1 << 26) # 128MB MSRStatus.SUCCESS """ diff --git a/mindspore/mindrecord/tools/cifar100_to_mr.py b/mindspore/mindrecord/tools/cifar100_to_mr.py index ca0b814de8e..df4a0fc2469 100644 --- a/mindspore/mindrecord/tools/cifar100_to_mr.py +++ b/mindspore/mindrecord/tools/cifar100_to_mr.py @@ -38,6 +38,10 @@ class Cifar100ToMR: """ A class to transform from cifar100 to MindRecord. + Note: + For details about Examples, please refer to `Converting the CIFAR-10 Dataset `_. + Args: source (str): the cifar100 directory to be transformed. destination (str): the MindRecord file path to transform into. diff --git a/mindspore/mindrecord/tools/cifar10_to_mr.py b/mindspore/mindrecord/tools/cifar10_to_mr.py index 961ba4db487..92d971c3c1d 100644 --- a/mindspore/mindrecord/tools/cifar10_to_mr.py +++ b/mindspore/mindrecord/tools/cifar10_to_mr.py @@ -38,6 +38,10 @@ class Cifar10ToMR: """ A class to transform from cifar10 to MindRecord. + Note: + For details about Examples, please refer to `Converting the CIFAR-10 Dataset `_. + Args: source (str): the cifar10 directory to be transformed. destination (str): the MindRecord file path to transform into. diff --git a/mindspore/mindrecord/tools/csv_to_mr.py b/mindspore/mindrecord/tools/csv_to_mr.py index 4e573c11482..01468326544 100644 --- a/mindspore/mindrecord/tools/csv_to_mr.py +++ b/mindspore/mindrecord/tools/csv_to_mr.py @@ -34,6 +34,10 @@ class CsvToMR: """ A class to transform from csv to MindRecord. + Note: + For details about Examples, please refer to `Converting CSV Dataset `_. + Args: source (str): the file path of csv. destination (str): the MindRecord file path to transform into. diff --git a/mindspore/mindrecord/tools/imagenet_to_mr.py b/mindspore/mindrecord/tools/imagenet_to_mr.py index d6fcb245dea..4825241b551 100644 --- a/mindspore/mindrecord/tools/imagenet_to_mr.py +++ b/mindspore/mindrecord/tools/imagenet_to_mr.py @@ -30,6 +30,10 @@ class ImageNetToMR: """ A class to transform from imagenet to MindRecord. + Note: + For details about Examples, please refer to `Converting the ImageNet Dataset `_. + Args: map_file (str): the map file that indicates label. The map file content should be like this: diff --git a/mindspore/mindrecord/tools/tfrecord_to_mr.py b/mindspore/mindrecord/tools/tfrecord_to_mr.py index 0434b0ad330..9f231453f0a 100644 --- a/mindspore/mindrecord/tools/tfrecord_to_mr.py +++ b/mindspore/mindrecord/tools/tfrecord_to_mr.py @@ -67,6 +67,10 @@ class TFRecordToMR: """ A class to transform from TFRecord to MindRecord. + Note: + For details about Examples, please refer to `Converting TFRecord Dataset `_. + Args: source (str): the TFRecord file to be transformed. destination (str): the MindRecord file path to transform into.