
Pytorch
曼车斯基
这个作者很懒,什么都没留下…
展开
-
Pytorch中的KL散度
Pytorch中的KL散度。原创 2022-07-16 10:24:13 · 2261 阅读 · 1 评论 -
cannot assign module before Module.__init__() call
issue:在把模型初始化并复制给变量的时候, 报错: cannot assign module before Module.__init__() callsolution:在被初始化的模型中没有调用super().__init__().原创 2021-10-07 21:23:30 · 926 阅读 · 0 评论 -
Pytorch 模型结构图 可视化
1. 安装graphvizbrew install graphviz我安装过程中碰到了 这个错误:Directory not empty @ dir_s_rmdir - /usr/local/opt/openssl需要卸载再重装 openssl:sudo rm -rf /usr/local/opt/opensslbrew install openssl2. pip install graphviz3. 使用graphviz 可视化一个mlpimport torc...原创 2021-03-29 14:47:41 · 608 阅读 · 0 评论 -
pytorch RuntimeError 错误:输入是Cuda类型,权重是普通类型
训练pytorch的时候碰到一个问题,程序总是报这个错:Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor) should be the same查了好久,才找到根本原因。输入的图像已经在GPU了,而模型还在CPU。增加以下代码即可:model = model.cuda( )...原创 2020-03-01 20:04:07 · 417 阅读 · 0 评论