仅1.8.1版本及以上使用,自动迁移方式较简单,且修改内容最少,只需在训练脚本中添加引入库代码。
import torch import torch_npu ..... from torch_npu.contrib import transfer_to_npu