pycharm连接Autodl服务器,运行报错
RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`
很多帖子说batch size太大,或者CUDA版本和torch不匹配,尝试无果。
def forward(self, x):
#print(x.shape)
x = self.Block1(x)
#print(x.shape)
x = self.Block2(x)
#print(x.shape)
x = self.Block3(x)
#print(x.shape)
x = x.view(x.size(0), -1)
#print(x.shape)
x = self.fc(x)
x = nn.LayerNorm(x.size())(x.cpu())
x = x.cuda()
#print(x.shape)
return x
最后把网络的各个shape打印出来,发现其实是数据shape不匹配。
self.fc = nn.Sequential(
nn.Linear(5760, 18)
)
出现这个问题先去看数据、网络维度