From 2cebcf25a7be6adea5197f7b0aff85f3909f0bf9 Mon Sep 17 00:00:00 2001 From: jinyaohui Date: Mon, 18 May 2020 16:16:38 +0800 Subject: [PATCH] remove some context params --- tutorials/source_en/quick_start/quick_start.md | 3 +-- tutorials/source_zh_cn/advanced_use/distributed_training.md | 3 +-- tutorials/source_zh_cn/quick_start/quick_start.md | 3 +-- .../distributed_training/resnet50_distributed_training.py | 2 -- tutorials/tutorial_code/lenet.py | 3 +-- tutorials/tutorial_code/resnet/cifar_resnet50.py | 2 -- tutorials/tutorial_code/sample_for_cloud/resnet50_train.py | 2 -- 7 files changed, 4 insertions(+), 14 deletions(-) diff --git a/tutorials/source_en/quick_start/quick_start.md b/tutorials/source_en/quick_start/quick_start.md index c14bacee..0ad49251 100644 --- a/tutorials/source_en/quick_start/quick_start.md +++ b/tutorials/source_en/quick_start/quick_start.md @@ -99,8 +99,7 @@ if __name__ == "__main__": parser.add_argument('--device_target', type=str, default="CPU", choices=['Ascend', 'GPU', 'CPU'], help='device where the code will be implemented (default: CPU)') args = parser.parse_args() - context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, - enable_mem_reuse=False) + context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) ... ``` diff --git a/tutorials/source_zh_cn/advanced_use/distributed_training.md b/tutorials/source_zh_cn/advanced_use/distributed_training.md index 45fd0488..50a5d660 100644 --- a/tutorials/source_zh_cn/advanced_use/distributed_training.md +++ b/tutorials/source_zh_cn/advanced_use/distributed_training.md @@ -250,7 +250,6 @@ from resnet import resnet50 device_id = int(os.getenv('DEVICE_ID')) context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") context.set_context(device_id=device_id) # set device_id -context.set_context(enable_loop_sink=True) def test_train_cifar(num_classes=10, epoch_size=10): context.set_auto_parallel_context(parallel_mode=ParallelMode.AUTO_PARALLEL, mirror_mean=True) @@ -263,7 +262,7 @@ def test_train_cifar(num_classes=10, epoch_size=10): model.train(epoch_size, dataset, callbacks=[loss_cb], dataset_sink_mode=True) ``` 其中, -- `dataset_sink_mode=True`,`enable_loop_sink=True`:表示采用数据集的下沉模式,即训练的计算下沉到硬件平台中执行。 +- `dataset_sink_mode=True`:表示采用数据集的下沉模式,即训练的计算下沉到硬件平台中执行。 - `LossMonitor`:能够通过回调函数返回Loss值,用于监控损失函数。 ## 运行脚本 diff --git a/tutorials/source_zh_cn/quick_start/quick_start.md b/tutorials/source_zh_cn/quick_start/quick_start.md index 60523885..f4ffebd7 100644 --- a/tutorials/source_zh_cn/quick_start/quick_start.md +++ b/tutorials/source_zh_cn/quick_start/quick_start.md @@ -101,8 +101,7 @@ if __name__ == "__main__": parser.add_argument('--device_target', type=str, default="CPU", choices=['Ascend', 'GPU', 'CPU'], help='device where the code will be implemented (default: CPU)') args = parser.parse_args() - context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, - enable_mem_reuse=False) + context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) ... ``` diff --git a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py index 6937cb1e..8064fb87 100644 --- a/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py +++ b/tutorials/tutorial_code/distributed_training/resnet50_distributed_training.py @@ -36,8 +36,6 @@ from resnet import resnet50 device_id = int(os.getenv('DEVICE_ID')) context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") context.set_context(device_id=device_id) # set device_id -context.set_context(enable_loop_sink=True) -context.set_context(enable_mem_reuse=False) init() rank_id = get_rank() diff --git a/tutorials/tutorial_code/lenet.py b/tutorials/tutorial_code/lenet.py index 797c63b9..84d0a9c5 100644 --- a/tutorials/tutorial_code/lenet.py +++ b/tutorials/tutorial_code/lenet.py @@ -195,8 +195,7 @@ if __name__ == "__main__": parser.add_argument('--device_target', type=str, default="CPU", choices=['Ascend', 'GPU', 'CPU'], help='device where the code will be implemented (default: CPU)') args = parser.parse_args() - context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target, - enable_mem_reuse=False) + context.set_context(mode=context.GRAPH_MODE, device_target=args.device_target) # download mnist dataset download_dataset() # learning rate setting diff --git a/tutorials/tutorial_code/resnet/cifar_resnet50.py b/tutorials/tutorial_code/resnet/cifar_resnet50.py index 40e66165..c7705904 100644 --- a/tutorials/tutorial_code/resnet/cifar_resnet50.py +++ b/tutorials/tutorial_code/resnet/cifar_resnet50.py @@ -55,8 +55,6 @@ data_home = args_opt.dataset_path context.set_context(mode=context.GRAPH_MODE, device_target="Ascend") context.set_context(device_id=device_id) -context.set_context(enable_loop_sink=False) -context.set_context(enable_mem_reuse=False) def create_dataset(repeat_num=1, training=True): """ diff --git a/tutorials/tutorial_code/sample_for_cloud/resnet50_train.py b/tutorials/tutorial_code/sample_for_cloud/resnet50_train.py index af5ee4fa..6d7030bf 100644 --- a/tutorials/tutorial_code/sample_for_cloud/resnet50_train.py +++ b/tutorials/tutorial_code/sample_for_cloud/resnet50_train.py @@ -117,8 +117,6 @@ def resnet50_train(args_opt): # set graph mode and parallel mode context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", save_graphs=False) context.set_context(device_id=device_id) - context.set_context(enable_loop_sink=True) - context.set_context(enable_mem_reuse=True) if device_num > 1: context.set_auto_parallel_context(device_num=device_num, parallel_mode=ParallelMode.DATA_PARALLEL, -- GitLab