# Cambricon PyTorch Model Migration Report ## Cambricon PyTorch Changes | No. | File | Description | | 1 | ShuffleNetV2Driver.py:9 | add "import torch_mlu" | | 2 | ShuffleNetV2Driver.py:30 | change "#self.device = self.get_device() #torch.device('cuda' if torch.cuda.is_available() else 'cpu')" to "#self.device = self.get_device() #torch.device('mlu' if torch.mlu.is_available() else 'cpu') " | | 3 | ShuffleNetV2Driver.py:31 | change "self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')" to "self.device = torch.device('mlu' if torch.mlu.is_available() else 'cpu') " | | 4 | ShuffleNetV2Driver.py:33 | change "print(torch.device('cuda' if torch.cuda.is_available() else 'cpu'))" to "print(torch.device('mlu' if torch.mlu.is_available() else 'cpu')) " | | 5 | ShuffleNetV2Driver.py:53 | change "device_gpu = torch.device('cuda')" to "device_gpu = torch.device('mlu') " | | 6 | ShuffleNetV2Driver.py:60 | change "self.fitlog.append('cuda', True, True)" to "self.fitlog.append('mlu', True, True) " | | 7 | iframe_feeder.py:10 | add "import torch_mlu" | | 8 | ShuffleNet/data.py:3 | add "import torch_mlu" | | 9 | ShuffleNet/model.py:3 | add "import torch_mlu" | | 10 | ShuffleNet/imagenet.py:8 | add "import torch_mlu" | | 11 | ShuffleNet/imagenet.py:82 | change "torch.cuda.manual_seed_all(args.seed)" to "torch.mlu.manual_seed_all(args.seed) " | | 12 | ShuffleNet/imagenet.py:95 | change "device = 'cuda:' + str(args.gpus[0])" to "device = 'mlu:' + str(args.gpus[0]) " | | 13 | ShuffleNet/flops_benchmark.py:2 | add "import torch_mlu" | | 14 | ShuffleNet/flops_benchmark.py:15 | change "fcn = fcn.cuda().train()" to "fcn = fcn.mlu().train() " | | 15 | ShuffleNet/run.py:6 | add "import torch_mlu" |