昇腾社区首页
中文
注册

PyTorch运行import torch_npu显示_has_compatible_shallow_copy_type重复注册warning问题

问题描述

warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因是PyTorch插件化解耦后,“_has_compatible_shallow_copy_type”缺乏对NPU Tensor的浅拷贝判断支持,因此需要重新注册“_has_compatible_shallow_copy_type”。

图1 错误提示

解决方案

该warning不影响模型的精度和性能,可以忽略。待NPU设备号合入社区或者后续PyTorch版本“_has_compatible_shallow_copy_type”注册方式发生变动,该warning会被解决。