diff --git a/tutorials/source_en/advanced_use/computer_vision_application.md b/tutorials/source_en/advanced_use/computer_vision_application.md index 0f2359f314616a4d6630f2e0c8943ba1688aa0f6..1e1c6e45288023585905f0d5b2a31fd77fd641f6 100644 --- a/tutorials/source_en/advanced_use/computer_vision_application.md +++ b/tutorials/source_en/advanced_use/computer_vision_application.md @@ -129,14 +129,14 @@ tar -zvxf cifar-10-binary.tar.gz Shuffle data randomly to disorder the data sequence and read data in batches for model training: ```python - # apply repeat operations - cifar_ds = cifar_ds.repeat(repeat_num) - # apply shuffle operations cifar_ds = cifar_ds.shuffle(buffer_size=10) # apply batch operations cifar_ds = cifar_ds.batch(batch_size=args_opt.batch_size, drop_remainder=True) + + # apply repeat operations + cifar_ds = cifar_ds.repeat(repeat_num) ``` diff --git a/tutorials/source_en/advanced_use/distributed_training.md b/tutorials/source_en/advanced_use/distributed_training.md index 7d859196e5dd8319faee3469a886ecfcbc0ab0ea..c34146b9b3d5c92cdf16898a25b78876d22d4175 100644 --- a/tutorials/source_en/advanced_use/distributed_training.md +++ b/tutorials/source_en/advanced_use/distributed_training.md @@ -145,15 +145,15 @@ def create_dataset(repeat_num=1, batch_size=32, rank_id=0, rank_size=1): data_set = data_set.map(input_columns="label", operations=type_cast_op) data_set = data_set.map(input_columns="image", operations=c_trans) - # apply repeat operations - data_set = data_set.repeat(repeat_num) - # apply shuffle operations data_set = data_set.shuffle(buffer_size=10) # apply batch operations data_set = data_set.batch(batch_size=batch_size, drop_remainder=True) + # apply repeat operations + data_set = data_set.repeat(repeat_num) + return data_set ``` diff --git a/tutorials/source_zh_cn/advanced_use/computer_vision_application.md b/tutorials/source_zh_cn/advanced_use/computer_vision_application.md index e6ad3d3cc803360f6093efadc6eb94a4f5dd6921..ca7c15ce61272d4d6e3cb566db73c22b8f69131e 100644 --- a/tutorials/source_zh_cn/advanced_use/computer_vision_application.md +++ b/tutorials/source_zh_cn/advanced_use/computer_vision_application.md @@ -131,14 +131,14 @@ tar -zvxf cifar-10-binary.tar.gz 最后通过数据混洗(shuffle)随机打乱数据的顺序,并按batch读取数据,进行模型训练: ```python - # apply repeat operations - cifar_ds = cifar_ds.repeat(repeat_num) - # apply shuffle operations cifar_ds = cifar_ds.shuffle(buffer_size=10) # apply batch operations cifar_ds = cifar_ds.batch(batch_size=args_opt.batch_size, drop_remainder=True) + + # apply repeat operations + cifar_ds = cifar_ds.repeat(repeat_num) ``` diff --git a/tutorials/source_zh_cn/advanced_use/distributed_training.md b/tutorials/source_zh_cn/advanced_use/distributed_training.md index b5b097b71dec1a43c102a27a36e9e9123369751c..8071832fe081cdc1c39fee8314c802df402faf69 100644 --- a/tutorials/source_zh_cn/advanced_use/distributed_training.md +++ b/tutorials/source_zh_cn/advanced_use/distributed_training.md @@ -144,15 +144,15 @@ def create_dataset(repeat_num=1, batch_size=32, rank_id=0, rank_size=1): data_set = data_set.map(input_columns="label", operations=type_cast_op) data_set = data_set.map(input_columns="image", operations=c_trans) - # apply repeat operations - data_set = data_set.repeat(repeat_num) - # apply shuffle operations data_set = data_set.shuffle(buffer_size=10) # apply batch operations data_set = data_set.batch(batch_size=batch_size, drop_remainder=True) + # apply repeat operations + data_set = data_set.repeat(repeat_num) + return data_set ``` diff --git a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py index 2db511100e77530273771361ffebeb36b34e1512..e363047ca876dd86c5f34ba3699c40bde59ad13c 100644 --- a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py +++ b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py @@ -69,15 +69,15 @@ def create_dataset(repeat_num=1, batch_size=32, rank_id=0, rank_size=1): data_set = data_set.map(input_columns="label", operations=type_cast_op) data_set = data_set.map(input_columns="image", operations=c_trans) - # apply repeat operations - data_set = data_set.repeat(repeat_num) - # apply shuffle operations data_set = data_set.shuffle(buffer_size=10) # apply batch operations data_set = data_set.batch(batch_size=batch_size, drop_remainder=True) + # apply repeat operations + data_set = data_set.repeat(repeat_num) + return data_set diff --git a/tutorials/tutorial_code/resnet/cifar_resnet50.py b/tutorials/tutorial_code/resnet/cifar_resnet50.py index da0620b7a469d75d03cb34957b5089000bc929c5..eedf7e0c4d172a42ba568649e32b60ea90c99904 100644 --- a/tutorials/tutorial_code/resnet/cifar_resnet50.py +++ b/tutorials/tutorial_code/resnet/cifar_resnet50.py @@ -91,15 +91,15 @@ def create_dataset(repeat_num=1, training=True): cifar_ds = cifar_ds.map(input_columns="label", operations=type_cast_op) cifar_ds = cifar_ds.map(input_columns="image", operations=c_trans) - # apply repeat operations - cifar_ds = cifar_ds.repeat(repeat_num) - # apply shuffle operations cifar_ds = cifar_ds.shuffle(buffer_size=10) # apply batch operations cifar_ds = cifar_ds.batch(batch_size=args_opt.batch_size, drop_remainder=True) + # apply repeat operations + cifar_ds = cifar_ds.repeat(repeat_num) + return cifar_ds if __name__ == '__main__':