cuDNN使用非肯定性算法,而且能够使用torch.backends.cudnn.enabled = False来进行禁用git
若是设置为torch.backends.cudnn.enabled =True,说明设置为使用使用非肯定性算法github
而后再设置:算法
torch.backends.cudnn.benchmark = true
那么cuDNN使用的非肯定性算法就会自动寻找最适合当前配置的高效算法,来达到优化运行效率的问题网络
通常来说,应该遵循如下准则:优化
因此咱们常常看见在代码开始出二者同时设置:spa
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True