TypeError: Cannot interpret ‘2‘ as a data type

错误行:

查看ones 定义

TypeError: Cannot interpret ‘2‘ as a data type_第1张图片

所以应该是:

b = torch.as_tensor(np,ones((2,3)))    这里省略了dtype.。

 

 

你可能感兴趣的:(debug,python)