1、问题描述:
在YOLOv5中添加CBAM注意力机制,运行后报错如下:
RuntimeError: adaptive_max_pool2d_backward_cuda does not have a deterministic implementation, but you set ‘torch.use_deterministic_algorithms(True)’. You can turn off determinism just for this operation, or you can use the ‘warn_only=True’ option, if that’s acceptable for your application. You can also file an issue at https://github.com/pytorch/pytorch/issues to help us prioritize adding deterministic support for this operation.
2、解决办法:
根据报错提示,找到train.py文件中的317行。
在scaler.scale(loss).backward()前添加torch.use_deterministic_algorithms(False)