[{"data":1,"prerenderedAt":547},["ShallowReactive",2],{"content-query-2dY0ZkVuGz":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"category":13,"body":14,"_type":541,"_id":542,"_source":543,"_file":544,"_stem":545,"_extension":546},"/technology-blogs/zh/2332","zh",false,"","昇思应用案例 | 分布式并行训练基础样例（CPU）","作者：Yeats_Liao ｜来源：CSDN","2023-05-10","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2023/05/11/72ebe1bffc7143018e3910954e412636.png","technology-blogs","大V博文",{"type":15,"children":16,"toc":533},"root",[17,25,44,49,63,71,79,100,109,114,121,126,136,141,149,154,161,169,177,187,199,204,209,217,224,233,238,243,251,256,261,266,271,276,284,289,294,299,304,309,317,325,331,336,344,349,354,359,364,372,380,386,391,399,404,412,420,425,432,439,444,452,460,465,470,475,480,488,493,503,513,523],{"type":18,"tag":19,"props":20,"children":22},"element","h1",{"id":21},"昇思应用案例-分布式并行训练基础样例cpu",[23],{"type":24,"value":8},"text",{"type":18,"tag":26,"props":27,"children":28},"p",{},[29,31,37,39],{"type":24,"value":30},"**作者：**",{"type":18,"tag":32,"props":33,"children":34},"strong",{},[35],{"type":24,"value":36},"Yeats_Liao",{"type":24,"value":38}," ｜",{"type":18,"tag":32,"props":40,"children":41},{},[42],{"type":24,"value":43},"来源：CSDN",{"type":18,"tag":26,"props":45,"children":46},{},[47],{"type":24,"value":48},"本案例主要讲解，如何在CPU平台上，使用昇思MindSpore。如需查看详细代码，可前往代码仓查看",{"type":18,"tag":26,"props":50,"children":51},{},[52,54],{"type":24,"value":53},"（",{"type":18,"tag":55,"props":56,"children":60},"a",{"href":57,"rel":58},"https://gitee.com/mindspore/docs/tree/r2.0.0-alpha/docs/sample%5C_code/distributed%5C_training%5C_cpu%EF%BC%89",[59],"nofollow",[61],{"type":24,"value":62},"https://gitee.com/mindspore/docs/tree/r2.0.0-alpha/docs/sample\\_code/distributed\\_training\\_cpu）",{"type":18,"tag":26,"props":64,"children":65},{},[66],{"type":18,"tag":32,"props":67,"children":68},{},[69],{"type":24,"value":70},"01",{"type":18,"tag":26,"props":72,"children":73},{},[74],{"type":18,"tag":32,"props":75,"children":76},{},[77],{"type":24,"value":78},"环境准备",{"type":18,"tag":26,"props":80,"children":81},{},[82,84,92,93],{"type":24,"value":83},"进入",{"type":18,"tag":32,"props":85,"children":86},{},[87],{"type":18,"tag":32,"props":88,"children":89},{},[90],{"type":24,"value":91},"昇思MindSpore官网",{"type":24,"value":53},{"type":18,"tag":55,"props":94,"children":97},{"href":95,"rel":96},"https://www.mindspore.cn/%EF%BC%89%EF%BC%8C%E7%82%B9%E5%87%BB%E4%B8%8A%E6%96%B9%E5%AE%89%E8%A3%85%E3%80%82",[59],[98],{"type":24,"value":99},"https://www.mindspore.cn/），点击上方安装。",{"type":18,"tag":26,"props":101,"children":102},{},[103],{"type":18,"tag":104,"props":105,"children":108},"img",{"alt":106,"src":107},"image.png","https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075253.12915995002817247021090251277654:50540510082858:2400:D5C4CCBE7E29A524E5B83ABBAF2CC4F41C4A3FE7E9B23FC0B7DE44175F03C7C8.png",[],{"type":18,"tag":26,"props":110,"children":111},{},[112],{"type":24,"value":113},"获取安装命令。",{"type":18,"tag":26,"props":115,"children":116},{},[117],{"type":18,"tag":104,"props":118,"children":120},{"alt":106,"src":119},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075312.33142068535273300807014999420381:50540510082858:2400:192AD49C1E02892A07CC5CB67A6812F6C645371FE337113348B484C9E846CEF6.png",[],{"type":18,"tag":26,"props":122,"children":123},{},[124],{"type":24,"value":125},"在ModelArts中打开一个Terminal，输入安装命令。",{"type":18,"tag":127,"props":128,"children":130},"pre",{"code":129},"conda install mindspore=2.0.0a0 -c mindspore -c conda-forge\n",[131],{"type":18,"tag":132,"props":133,"children":134},"code",{"__ignoreMap":7},[135],{"type":24,"value":129},{"type":18,"tag":26,"props":137,"children":138},{},[139],{"type":24,"value":140},"再点击侧边栏中的Clone a Repository，输入。",{"type":18,"tag":127,"props":142,"children":144},{"code":143},"https://gitee.com/mindspore/docs.git\n",[145],{"type":18,"tag":132,"props":146,"children":147},{"__ignoreMap":7},[148],{"type":24,"value":143},{"type":18,"tag":26,"props":150,"children":151},{},[152],{"type":24,"value":153},"可以看到docs项目导入成功。",{"type":18,"tag":26,"props":155,"children":156},{},[157],{"type":18,"tag":104,"props":158,"children":160},{"alt":106,"src":159},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075333.91535865682196725653749611401092:50540510082858:2400:547C1BD64CF0BA0E8B91178F4E8AC23DDA0198F50EFEB5B81D6E8C4EAFABE5D5.png",[],{"type":18,"tag":26,"props":162,"children":163},{},[164],{"type":18,"tag":32,"props":165,"children":166},{},[167],{"type":24,"value":168},"02",{"type":18,"tag":26,"props":170,"children":171},{},[172],{"type":18,"tag":32,"props":173,"children":174},{},[175],{"type":24,"value":176},"准备环节",{"type":18,"tag":178,"props":179,"children":181},"h2",{"id":180},"_1下载数据集",[182],{"type":18,"tag":32,"props":183,"children":184},{},[185],{"type":24,"value":186},"1.下载数据集",{"type":18,"tag":26,"props":188,"children":189},{},[190,192],{"type":24,"value":191},"本样例采用CIFAR-10数据集（",{"type":18,"tag":55,"props":193,"children":196},{"href":194,"rel":195},"http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz%EF%BC%89%EF%BC%8C%E7%94%B110%E7%B1%BB32%5C*32%E7%9A%84%E5%BD%A9%E8%89%B2%E5%9B%BE%E7%89%87%E7%BB%84%E6%88%90%EF%BC%8C%E6%AF%8F%E7%B1%BB%E5%8C%85%E5%90%AB6000%E5%BC%A0%E5%9B%BE%E7%89%87%EF%BC%8C%E5%85%B6%E4%B8%AD%E8%AE%AD%E7%BB%83%E9%9B%86%E5%85%B150000%E5%BC%A0%E5%9B%BE%E7%89%87%EF%BC%8C%E6%B5%8B%E8%AF%95%E9%9B%86%E5%85%B110000%E5%BC%A0%E5%9B%BE%E7%89%87%E3%80%82",[59],[197],{"type":24,"value":198},"http://www.cs.toronto.edu/~kriz/cifar-10-binary.tar.gz），由10类32\\*32的彩色图片组成，每类包含6000张图片，其中训练集共50000张图片，测试集共10000张图片。",{"type":18,"tag":26,"props":200,"children":201},{},[202],{"type":24,"value":203},"将下载的数据集上传到，解压后文件夹为cifar-10-batches-bin。",{"type":18,"tag":26,"props":205,"children":206},{},[207],{"type":24,"value":208},"mindspore.dataset提供了面向图像、文本、音频等不同数据类型的Transforms，同时也支持使用Lambda函数。下面分别对其进行介绍。",{"type":18,"tag":127,"props":210,"children":212},{"code":211},"tar -zxvf cifar-10-binary.tar.gz \n",[213],{"type":18,"tag":132,"props":214,"children":215},{"__ignoreMap":7},[216],{"type":24,"value":211},{"type":18,"tag":26,"props":218,"children":219},{},[220],{"type":18,"tag":104,"props":221,"children":223},{"alt":106,"src":222},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075406.21287251919015751110103258900005:50540510082858:2400:8D1B72CE062A154CA9B34C7B6091A9F6992E677AFF38EE97E955E99762FE80C3.png",[],{"type":18,"tag":178,"props":225,"children":227},{"id":226},"_2配置分布式环境",[228],{"type":18,"tag":32,"props":229,"children":230},{},[231],{"type":24,"value":232},"2.配置分布式环境",{"type":18,"tag":26,"props":234,"children":235},{},[236],{"type":24,"value":237},"CPU上数据并行主要分为单机多节点和多机多节点两种并行方式(一个训练进程可以理解为一个节点)。在运行训练脚本前，需要搭建组网环境，主要是环境变量配置和训练脚本里初始化接口的调用。",{"type":18,"tag":26,"props":239,"children":240},{},[241],{"type":24,"value":242},"环境变量配置如下：",{"type":18,"tag":127,"props":244,"children":246},{"code":245},"export MS_WORKER_NUM=8                # Worker number\nexport MS_SCHED_HOST=xxx.xxx.xxx..xxx        # Scheduler IP address\nexport MS_SCHED_PORT=6667             # Scheduler port\nexport MS_ROLE=MS_WORKER              # The role of this node: MS_SCHED represents the scheduler, MS_WORKER represents the worker\n",[247],{"type":18,"tag":132,"props":248,"children":249},{"__ignoreMap":7},[250],{"type":24,"value":245},{"type":18,"tag":26,"props":252,"children":253},{},[254],{"type":24,"value":255},"**MS_WORKER_NUM：**表示worker节点数，多机场景下，worker节点数是每机worker节点之和。",{"type":18,"tag":26,"props":257,"children":258},{},[259],{"type":24,"value":260},"**MS_SCHED_HOST：**表示scheduler节点ip地址。",{"type":18,"tag":26,"props":262,"children":263},{},[264],{"type":24,"value":265},"**MS_SCHED_PORT：**表示scheduler节点服务端口，用于接收worker节点发送来的ip和服务端口，然后将收集到的所有worker节点ip和端口下发给每个worker。",{"type":18,"tag":26,"props":267,"children":268},{},[269],{"type":24,"value":270},"**MS_ROLE：**表示节点类型，分为worker（MS_WORKER）和scheduler（MS_SCHED）两种。不管是单机多节点还是多机多节点，都需要配置一个scheduler节点用于组网。",{"type":18,"tag":26,"props":272,"children":273},{},[274],{"type":24,"value":275},"训练脚本里初始化接口调用如下：",{"type":18,"tag":127,"props":277,"children":279},{"code":278},"import mindspore as ms\nfrom mindspore.communication import init\n\nms.set_context(mode=ms.GRAPH_MODE, device_target=\"CPU\")\nms.set_auto_parallel_context(parallel_mode=ms.ParallelMode.DATA_PARALLEL, gradients_mean=True)\nms.set_ps_context(enable_ssl=False)\ninit()\n",[280],{"type":18,"tag":132,"props":281,"children":282},{"__ignoreMap":7},[283],{"type":24,"value":278},{"type":18,"tag":26,"props":285,"children":286},{},[287],{"type":24,"value":288},"**ms.set_context(mode=context.GRAPH_MODE, device_target=“CPU”)：**指定模式为图模式（CPU上PyNative模式下不支持并行），设备为CPU。",{"type":18,"tag":26,"props":290,"children":291},{},[292],{"type":24,"value":293},"ms.set_auto_parallel_context(parallel_mode=ParallelMode.DATA_PARALLEL,",{"type":18,"tag":26,"props":295,"children":296},{},[297],{"type":24,"value":298},"**gradients_mean=True)：**指定数据并行模式，gradients_mean=True表示梯度归约后会进行一个求平均，当前CPU上梯度归约仅支持求和。",{"type":18,"tag":26,"props":300,"children":301},{},[302],{"type":24,"value":303},"**ms.set_ps_context：**配置安全加密通信，可通过ms.set_ps_context(enable_ssl=True)开启安全加密通信，默认为False，关闭安全加密通信。",{"type":18,"tag":26,"props":305,"children":306},{},[307],{"type":24,"value":308},"**init：**节点初始化，初始化完成表示组网成功。",{"type":18,"tag":26,"props":310,"children":311},{},[312],{"type":18,"tag":32,"props":313,"children":314},{},[315],{"type":24,"value":316},"03",{"type":18,"tag":26,"props":318,"children":319},{},[320],{"type":18,"tag":32,"props":321,"children":322},{},[323],{"type":24,"value":324},"加载数据集",{"type":18,"tag":178,"props":326,"children":328},{"id":327},"分布式训练时数据集是以数据并行的方式导入的下面我们以cifar-10数据集为例介绍以数据并行方式导入cifar-10数据集的方法data_path是指数据集的路径即cifar-10-batches-bin文件夹的路径",[329],{"type":24,"value":330},"分布式训练时，数据集是以数据并行的方式导入的。下面我们以CIFAR-10数据集为例，介绍以数据并行方式导入CIFAR-10数据集的方法，data_path是指数据集的路径，即cifar-10-batches-bin文件夹的路径。",{"type":18,"tag":26,"props":332,"children":333},{},[334],{"type":24,"value":335},"样例代码如下：",{"type":18,"tag":127,"props":337,"children":339},{"code":338},"import mindspore as ms\nimport mindspore.dataset as ds\nimport mindspore.dataset.vision as vision\nimport mindspore.dataset.transforms as transforms\nfrom mindspore.communication import get_rank, get_group_size\n\ndef create_dataset(data_path, repeat_num=1, batch_size=32):\n    \"\"\"Create training dataset\"\"\"\n    resize_height = 224\n    resize_width = 224\n    rescale = 1.0 / 255.0\n    shift = 0.0\n\n    # get rank_id and rank_size\n    rank_size = get_group_size()\n    rank_id = get_rank()\n    data_set = ds.Cifar10Dataset(data_path, num_shards=rank_size, shard_id=rank_id)\n\n    # define map operations\n    random_crop_op = vision.RandomCrop((32, 32), (4, 4, 4, 4))\n    random_horizontal_op = vision.RandomHorizontalFlip()\n    resize_op = vision.Resize((resize_height, resize_width))\n    rescale_op = vision.Rescale(rescale, shift)\n    normalize_op = vision.Normalize((0.4465, 0.4822, 0.4914), (0.2010, 0.1994, 0.2023))\n    changeswap_op = vision.HWC2CHW()\n    type_cast_op = transforms.TypeCast(ms.int32)\n\n    c_trans = [random_crop_op, random_horizontal_op]\n    c_trans += [resize_op, rescale_op, normalize_op, changeswap_op]\n\n    # apply map operations on images\n    data_set = data_set.map(operations=type_cast_op, input_columns=\"label\")\n    data_set = data_set.map(operations=c_trans, input_columns=\"image\")\n\n    # apply shuffle operations\n    data_set = data_set.shuffle(buffer_size=10)\n\n    # apply batch operations\n    data_set = data_set.batch(batch_size=batch_size, drop_remainder=True)\n\n    # apply repeat operations\n    data_set = data_set.repeat(repeat_num)\n\n    return data_set\n",[340],{"type":18,"tag":132,"props":341,"children":342},{"__ignoreMap":7},[343],{"type":24,"value":338},{"type":18,"tag":26,"props":345,"children":346},{},[347],{"type":24,"value":348},"与单机不同的是，在构造Cifar10Dataset时需要传入num_shards和shard_id参数，分别对应worker节点数和逻辑序号，可通过框架接口获取，如下：",{"type":18,"tag":26,"props":350,"children":351},{},[352],{"type":24,"value":353},"**get_group_size：**获取集群中worker节点数。",{"type":18,"tag":26,"props":355,"children":356},{},[357],{"type":24,"value":358},"**get_rank：**获取当前worker节点在集群中的逻辑序号。",{"type":18,"tag":26,"props":360,"children":361},{},[362],{"type":24,"value":363},"数据并行模式加载数据集时，建议对每卡指定相同的数据集文件，若是各卡加载的数据集不同，可能会影响计算精度。",{"type":18,"tag":26,"props":365,"children":366},{},[367],{"type":18,"tag":32,"props":368,"children":369},{},[370],{"type":24,"value":371},"04",{"type":18,"tag":26,"props":373,"children":374},{},[375],{"type":18,"tag":32,"props":376,"children":377},{},[378],{"type":24,"value":379},"模型定义",{"type":18,"tag":178,"props":381,"children":383},{"id":382},"数据并行模式下网络定义与单机写法一致可参考resnet网络样例脚本优化器损失函数及训练模型定义可参考训练模型定义",[384],{"type":24,"value":385},"数据并行模式下，网络定义与单机写法一致，可参考ResNet网络样例脚本。优化器、损失函数及训练模型定义可参考训练模型定义。",{"type":18,"tag":26,"props":387,"children":388},{},[389],{"type":24,"value":390},"完整训练脚本代码参考样例，下面列出训练启动代码。",{"type":18,"tag":127,"props":392,"children":394},{"code":393},"import os\nimport mindspore as ms\nimport mindspore.nn as nn\nfrom mindspore import train\nfrom mindspore.communication import init\nfrom resnet import resnet50\n\ndef train_resnet50_with_cifar10(epoch_size=10):\n    \"\"\"Start the training\"\"\"\n    loss_cb = train.LossMonitor()\n    data_path = os.getenv('DATA_PATH')\n    dataset = create_dataset(data_path)\n    batch_size = 32\n    num_classes = 10\n    net = resnet50(batch_size, num_classes)\n    loss = SoftmaxCrossEntropyExpand(sparse=True)\n    opt = nn.Momentum(filter(lambda x: x.requires_grad, net.get_parameters()), 0.01, 0.9)\n    model = ms.Model(net, loss_fn=loss, optimizer=opt)\n    model.train(epoch_size, dataset, callbacks=[loss_cb], dataset_sink_mode=True)\n\n\nif __name__ == \"__main__\":\n    ms.set_context(mode=ms.GRAPH_MODE, device_target=\"CPU\")\n    ms.set_auto_parallel_context(parallel_mode=ms.ParallelMode.DATA_PARALLEL, gradients_mean=True)\n    ms.set_ps_context(enable_ssl=False)\n    init()\n    train_resnet50_with_cifar10()\n",[395],{"type":18,"tag":132,"props":396,"children":397},{"__ignoreMap":7},[398],{"type":24,"value":393},{"type":18,"tag":26,"props":400,"children":401},{},[402],{"type":24,"value":403},"脚本里create_dataset和SoftmaxCrossEntropyExpand接口引用自distributed_training_cpu，resnet50接口引用自ResNet网络样例脚本。",{"type":18,"tag":26,"props":405,"children":406},{},[407],{"type":18,"tag":32,"props":408,"children":409},{},[410],{"type":24,"value":411},"05",{"type":18,"tag":26,"props":413,"children":414},{},[415],{"type":18,"tag":32,"props":416,"children":417},{},[418],{"type":24,"value":419},"启动训练",{"type":18,"tag":26,"props":421,"children":422},{},[423],{"type":24,"value":424},"在CPU平台上，以单机8节点为例，执行分布式训练。进入到 /home/ma-user/work/docs/docs/sample_code/distributed_training_cpu目录下。",{"type":18,"tag":26,"props":426,"children":427},{},[428],{"type":18,"tag":104,"props":429,"children":431},{"alt":106,"src":430},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075513.81890823263541379014378302003671:50540510082858:2400:D3C4A234631FB3293EA5AC457090B62D14482B038014918DDFD3A6C2185A2A5E.png",[],{"type":18,"tag":26,"props":433,"children":434},{},[435],{"type":18,"tag":104,"props":436,"children":438},{"alt":106,"src":437},"https://fileserver.developer.huaweicloud.com/FileServer/getFile/cmtybbs/e64/154/b38/90a1d5d431e64154b387b3660e356ff5.20230511075523.23600288282340293165173249003512:50540510082858:2400:D4E20B47269FE27F2E1BEF9A5EE1561175BCB951B5CFF43131EC8BE40299F952.png",[],{"type":18,"tag":26,"props":440,"children":441},{},[442],{"type":24,"value":443},"通过以下shell脚本启动训练，指令bash run.sh /dataset/cifar-10-batches-bin，可以看到已经训练成功了。",{"type":18,"tag":127,"props":445,"children":447},{"code":446},"(PyTorch-1.8) [ma-user distributed_training_cpu]$bash run.sh cifar-10-batches-bin\n==============================================================================================================\nPlease run the script with dataset path, such as: \nbash run.sh DATA_PATH\nFor example: bash run.sh /path/dataset\nIt is better to use the absolute path.\n==============================================================================================================\nscheduler start success!\nworker 0 start success with pid 8240\nworker 1 start success with pid 8241\nworker 2 start success with pid 8242\nworker 3 start success with pid 8243\nworker 4 start success with pid 8244\nworker 5 start success with pid 8245\nworker 6 start success with pid 8246\nworker 7 start success with pid 8247\n",[448],{"type":18,"tag":132,"props":449,"children":450},{"__ignoreMap":7},[451],{"type":24,"value":446},{"type":18,"tag":127,"props":453,"children":455},{"code":454},"#!/bin/bash\n# run data parallel training on CPU\n\necho \"==============================================================================================================\"\necho \"Please run the script with dataset path, such as: \"\necho \"bash run.sh DATA_PATH\"\necho \"For example: bash run.sh /path/dataset\"\necho \"It is better to use the absolute path.\"\necho \"==============================================================================================================\"\nset -e\nDATA_PATH=$1\nexport DATA_PATH=${DATA_PATH}\n\nexport MS_WORKER_NUM=8\nexport MS_SCHED_HOST=xxx.xxx.xxx..xxx\nexport MS_SCHED_PORT=8117\n\n# Launch 1 scheduler.\nexport MS_ROLE=MS_SCHED\npython3 resnet50_distributed_training.py >scheduler.txt 2>&1 &\necho \"scheduler start success!\"\n\n# Launch 8 workers.\nexport MS_ROLE=MS_WORKER\nfor((i=0;i\u003C${MS_WORKER_NUM};i++));\ndo\n    python3 resnet50_distributed_training.py >worker_$i.txt 2>&1 &\n    echo \"worker ${i} start success with pid ${!}\"\ndone\n",[456],{"type":18,"tag":132,"props":457,"children":458},{"__ignoreMap":7},[459],{"type":24,"value":454},{"type":18,"tag":26,"props":461,"children":462},{},[463],{"type":24,"value":464},"其中，resnet50_distributed_training.py为定义的训练脚本。对于多机多节点场景，需要在每个机器上按照这种方式，启动相应的worker节点参与训练，但scheduler节点只有一个，只需要在其中一个机器上(即MS_SCHED_HOST）启动即可。",{"type":18,"tag":26,"props":466,"children":467},{},[468],{"type":24,"value":469},"定义的MS_WORKER_NUM值，表示需要启动相应数量的worker节点参与训练，否则组网不成功。",{"type":18,"tag":26,"props":471,"children":472},{},[473],{"type":24,"value":474},"虽然针对scheduler节点也启动了训练脚本，但scheduler主要用于组网，并不会参与训练。",{"type":18,"tag":26,"props":476,"children":477},{},[478],{"type":24,"value":479},"训练一段时间，打开worker_0日志，训练信息如下：",{"type":18,"tag":127,"props":481,"children":483},{"code":482},"(PyTorch-1.8) [ma-user distributed_training_cpu]$tail -f worker_0.txt \n\n……\nepoch: 1 step: 1, loss is 1.4686084\nepoch: 1 step: 2, loss is 1.3278534\nepoch: 1 step: 3, loss is 1.4246798\nepoch: 1 step: 4, loss is 1.4920032\nepoch: 1 step: 5, loss is 1.4324203\nepoch: 1 step: 6, loss is 1.432581\nepoch: 1 step: 7, loss is 1.319618\n",[484],{"type":18,"tag":132,"props":485,"children":486},{"__ignoreMap":7},[487],{"type":24,"value":482},{"type":18,"tag":26,"props":489,"children":490},{},[491],{"type":24,"value":492},"往期回顾",{"type":18,"tag":26,"props":494,"children":495},{},[496],{"type":18,"tag":55,"props":497,"children":500},{"href":498,"rel":499},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247595341&idx=1&sn=057234e7239c47bfdb48f253ae5ccf23&chksm=c11e6502f669ec14fa5c21bd52b565d4775d45620b0a507bbd4cef467c30706bea47e90c96f0&scene=21#wechat_redirect",[59],[501],{"type":24,"value":502},"昇思应用案例 | 小白都能看懂的数据变换Transforms",{"type":18,"tag":26,"props":504,"children":505},{},[506],{"type":18,"tag":55,"props":507,"children":510},{"href":508,"rel":509},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247594712&idx=1&sn=1ad2dced8eabe180749e74ab2ffe1867&chksm=c11e6297f669eb81a33c1f14f4ea28a530b91bdf833c93323e8db465524fec390c3c1428268b&scene=21#wechat_redirect",[59],[511],{"type":24,"value":512},"昇思应用案例 | FGSM网络对抗攻击，轻松调节模型精度",{"type":18,"tag":26,"props":514,"children":515},{},[516],{"type":18,"tag":55,"props":517,"children":520},{"href":518,"rel":519},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247594000&idx=1&sn=58054d20cdf29acc98e694a50a148247&chksm=c11e605ff669e949e7e4deefad360efffb9f4d05481bf7ae94d7fd2348c487cc7918996068da&scene=21#wechat_redirect",[59],[521],{"type":24,"value":522},"昇思应用案例 | Colorization实现灰度图像自动着色",{"type":18,"tag":26,"props":524,"children":525},{},[526],{"type":18,"tag":55,"props":527,"children":530},{"href":528,"rel":529},"http://mp.weixin.qq.com/s?__biz=MzkxMTM2MjMzNg==&mid=2247592826&idx=1&sn=1a02eb32ea94800f7911f73ad171db71&chksm=c11e7b35f669f223599952cb8492c2ca9e0221b8c1ae5ea5f29489cda5ffb6fb0cb8bcbfae2c&scene=21#wechat_redirect",[59],[531],{"type":24,"value":532},"昇思应用案例 | 模型压缩50倍，超轻量级网络CNN模型SqueezeNet技术实践",{"title":7,"searchDepth":534,"depth":534,"links":535},4,[536,538,539,540],{"id":180,"depth":537,"text":186},2,{"id":226,"depth":537,"text":232},{"id":327,"depth":537,"text":330},{"id":382,"depth":537,"text":385},"markdown","content:technology-blogs:zh:2332.md","content","technology-blogs/zh/2332.md","technology-blogs/zh/2332","md",1776506121661]