python3 -c "import torch;import torch_npu; a=torch.randn(3, 4).npu(); print(a + a);" 运行报错
收藏回复举报
python3 -c "import torch;import torch_npu; a=torch.randn(3, 4).npu(); print(a + a);" 运行报错
t('forum.solved') 已解决
发表于2024-11-15 14:51:31
0 查看

python版本:3.7.10

torch版本:1.11.0

torch-npu版本:v5.0.rc1-pytorch1.11.0

运行检查报一下异常:

(python37) root@vn0:/opt/kcpt# python3 -c "import torch;import torch_npu; a=torch.randn(3, 4).npu(); print(a + a);" 

Traceback (most recent call last): 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/__init__.py", line 29, in <module> 

    import torch_npu.npu 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/npu/__init__.py", line 44, in <module> 

    from .utils import (is_initialized, _lazy_call, _lazy_init, init, set_dump, 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/npu/utils.py", line 27, in <module> 

    import torch_npu._C 

ImportError: /opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/lib/libtorch_npu.so: undefined symbol: _ZNK5torch8autograd4Node4nameB5cxx11Ev 

Traceback (most recent call last): 

  File "<string>", line 1, in <module> 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/__init__.py", line 38, in <module> 

    import torch_npu.npu.amp 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/npu/__init__.py", line 44, in <module> 

    from .utils import (is_initialized, _lazy_call, _lazy_init, init, set_dump, 

  File "/opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/npu/utils.py", line 27, in <module> 

    import torch_npu._C 

ImportError: /opt/kcpt/anaconda/envs/python37/lib/python3.7/site-packages/torch_npu/lib/libtorch_npu.so: undefined symbol: _ZNK5torch8autograd4Node4nameB5cxx11Ev 

我要发帖子