torch.Tensor和torch.tensor有什么区别?

郝春妮

关注

阅读 88

2022-08-20


问题

写代码的时候碰到过这个错误:

torch.Tensor和torch.tensor有什么区别?_深度学习

TypeError: new() received an invalid combination of arguments - got (list, dtype=torch.dtype), but expected one of:

原因

那么到底是hi什么原因呢? ​torch.Tensor()​torch.tensor()​ 写法会导致得到的tensor具有不同的数值类型。 具体示例如下:

torch.Tensor和torch.tensor有什么区别?_python_02


相关推荐

精彩评论(0)

0 0 举报