![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pytorch
xiongzai2016
这个作者很懒,什么都没留下…
展开
-
windows安装torch_sparse\torch_geometric\torch_cluster
windows上通过命令窗口直接pip install torch_sparse会报一大片错误。那就通过直接通过.whl源文件安装。https://pytorch-geometric.com/whl/torch-1.4.0.html如我要安装torch_sparse,安装环境是python3.6, pytorch1.4版本(这个影响不大), 没有Gpu,那么我选择了红色框出来的这个版本进行下载安装。下载后进入到该文件所在的目录下,并安装。如下图命令:因为我安装完了,所以就不显示安装完成的样子。相原创 2020-09-07 08:33:02 · 2186 阅读 · 0 评论 -
pytorch detach()
detach()的主要用途是将有梯度的变量变成没有梯度的,即requires grad=True变成requires grad=False. 因为网络内的值或输出的值都有梯度,所以要想将值转换成其他类型,都需要先去掉梯度.如转换成numpy类型,一般这样搭配使用:.detach().cpu().numpy()或.detach().numpy(),其中第一个是将GPU类型变成CPU类型,再继续转换成numpy类型,第二种是CPU类型转换成numpy()类型,如果你的电脑是用GPU训练就用第一种,用CPU训练就原创 2020-07-07 11:10:38 · 1096 阅读 · 0 评论 -
TypeError: arange(): argument ‘end‘ (position 1) must be Number, not numpy.int32
下面两个不同的报错其实犯了同一个错误①TypeError: arange(): argument ‘end’ (position 1) must be Number, not numpy.int32②TypeError: arange() received an invalid combination of arguments - got (numpy.int32, numpy.int32), but expected one of:(Number end, Tensor out, torch.dt原创 2020-07-05 10:55:46 · 2851 阅读 · 0 评论