pytorch
qq_ddddd
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Pytorch报错:RuntimeError : bool value of Tensor with more than one value is ambiguous. 的可能原因
1、使用损失函数的时候,不能直接写loss = nn.CrossEntropyLoss(input, target)或者是nn.NLLLoss (input, target),必须先把求损失的库函数定义到一个自己命名的函数再调用。例如:loss_fn = nn.NLLLoss()loss = loss_fn(input, target)2、定义库函数的时候要记得加括号:是loss_fn = nn.NLLLoss()而不是loss_fn = nn.NLLLoss...原创 2022-04-10 18:58:01 · 3334 阅读 · 0 评论 -
CentOS查看CUDA版本
1、在python环境中查看服务器上有没有安装CUDApythonimport torchtorch.cuda.is_available()显示True即为安装过了2、不用进python环境,直接查看版本:原创 2021-12-08 16:08:11 · 3624 阅读 · 0 评论 -
使用Pytorch进行数据预处理报错:can‘t convert np.ndarray of type numpy.object_.
1 问题TypeError: can’t convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.2 出错代码X = torch.from_numpy(X_data).type(torch.float32)3 出错原因在nump原创 2021-03-15 21:13:59 · 5926 阅读 · 1 评论
分享