打开微信,使用扫一扫进入页面后,点击右上角菜单,
点击“发送给朋友”或“分享到朋友圈”完成分享
(llm) [root@gpu-11-51 my_offline_packages]# python
Python 3.11.10 (main, Oct 3 2024, 07:29:13) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> # 修复后的原始代码
>>> import torch
import torch_mlu
# 修复前(会失败):
# a = torch.randn(3, 3, device='mlu')
# 修复后:
a = torch.randn(3, 3).mlu() # 先在CPU创建,再移动
b = torch.ones(3, 3).mlu() # 这个可以直接创建
c = a + b
print(f"成功!结果设备: {c.device}")
print(f"结果形状: {c.shape}")
print(f"结果值:\n{c.cpu()}") # 移回CPU显示
>>> import torch_mlu
>>>
>>> # 修复前(会失败):
>>> # a = torch.randn(3, 3, device='mlu')
>>>
>>> # 修复后:
>>> a = torch.randn(3, 3).mlu() # 先在CPU创建,再移动
>>> b = torch.ones(3, 3).mlu() # 这个可以直接创建
>>>
>>> c = a + b
[2026-01-13 14:11:50.335284][CNNL][ERROR][923993][Card:0]: [cnnlCreate] An internal error occured. When convert isa version to device failed. return unknown device. isa version = 372
2026-01-13 14:11:50.335693: [cnrtError] [923993] [Card: 0] cnrtInvokeKernel: Found kernel(_Z23MLUOpTensorElementBlockIL23cnnlOpTensorParamMode_t0EfffffEvPKT0_PKT1_PT2_T4_S9_S9_18cnnlOpTensorDesc_t8DataInfo) but not load(632015).
[2026-01-13 14:11:50.335724][CNNL][ERROR][923993][Card:0]: Check failed: Found failed to call the driver-api function. after invoke kernel (MLUOpTensorElementBlock<Param110, float, float, float, float, float> <<<kDim, kType, handle->queue>>>((float *)a_input, (float *)b_input, (float *)c, *(float *)alpha1_v, *(float *)alpha2_v, *(float *)beta_v, op_type, data_info))
[2026-01-13 14:11:50.335763][CNNL][ERROR][923993][Card:0]: [cnnlOpTensor] An internal error occured.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: CNNL error: CNNL_STATUS_INTERNAL_ERROR
>>> print(f"成功!结果设备: {c.device}")
热门帖子
精华帖子