解决:RuntimeError: reflection_pad2d_backward_cuda does not have a deterministic implementation......

1. 场景:在改进yolov7过程中,出现的错误。

2. 错误描述:RuntimeError: reflection_pad2d_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.

3. 解决:找到torch.use_deterministic_algorithms()方法,将warn_only = False ,改为warn_only = True。

4. 原因:

        reflection_pad2d_backward_cuda没有确定性实现。设置PyTorch操作是否必须使用“确定性”算法。也就是说,在给定相同输入的情况下,当在相同的软件和硬件上运行时,算法总是产生相同的输出。启用后,操作将在可用时使用确定性算法,如果只有不确定性算法可用,则在调用时会抛出RuntimeError

        如果为 True,则使潜在的非确定性操作切换到确定性算法或引发运行时错误。如果为 False,则允许非确定性操作。

5. 警告:实际上这个设置对精度影响不大,影响精度在小数点后几位。如果不是对精度要求极高,其实不太建议修改,因为会使计算效率降低。确定性模式可能会对性能产生影响,具体取决于您的型号。

        

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值