![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Pytorch
Frank(Zhiyang-Dou)
A Ph.D. candidate at HKU. Mainly focus on CG.
展开
-
RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /opt/conda/conda-bld/
问题RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /opt/conda/conda-bld/解决出现这个问题很可能是你的CUDA编号不对。比如你设置的变量中使用了2,3号GPU但是实际上你只有两个GPU0,1 这会导致该错误。...原创 2021-10-14 19:52:42 · 1821 阅读 · 1 评论 -
expected seqence object with len>=0 or a single integer
综述报错内容:expected seqence object with len>=0 or a single integer解决这个错误一般当模型forward结束后将数据移到了CPU导致的。因此将这部分的cpu().numpy()取出后就可以了。原创 2021-08-28 22:08:55 · 1320 阅读 · 0 评论 -
pytorch加载部分模型权重
综述pytorch load模型部分权重:checkpoint= torch.load('checkpoint.pth'))model_dict = model.state_dict()pretrained_dict = {k: v for k, v in checkpoint['state_dict'].items() if k in model_dict} model_dict.update(pretrained_dict)model.load_state_dict(model_dict原创 2021-08-08 18:13:49 · 730 阅读 · 0 评论 -
AttributeError: module 'keras.backend.tensorflow_backend' has no attribute '_is_tf_1'解决方法
综述报错:AttributeError: module ‘keras.backend.tensorflow_backend’ has no attribute ‘_is_tf_1’解决方法版本不对应:请在这里检查。原创 2019-12-20 10:45:25 · 11786 阅读 · 8 评论 -
DL-pytorch初步自定义网络
综述使用pytorch定义一个简单的网络import numpy as npimport torch.nn as nnimport torch.optim as optimclass SubclassModel (nn.Module): def __init__(self): super().__init__() self.hidden_linea...原创 2019-12-06 09:58:41 · 179 阅读 · 0 评论