RuntimeError:upsample_bilinear2d_backward_out_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.

🔆🔆🔆分析

①解决:找到torch.use_deterministic_algorithms()方法,将warn_only = False ,改为warn_only = True。但是小编没有找到torch.use_deterministic_algorithms()方法。

小编用另外一种方法解决:train,py中在scaler.scale(loss).backward()前添加torch.use_deterministic_algorithms(False)

图片

torch.use_deterministic_algorithms(False)  # addedscaler.scale(loss).backward()

②原因:———_backward_cuda没有确定性实现。设置PyTorch操作是否必须使用“确定性”算法。也就是说,在给定相同输入的情况下,当在相同的软件和硬件上运行时,算法总是产生相同的输出。启用后,操作将在可用时使用确定性算法,如果只有不确定性算法可用,则在调用时会抛出RuntimeError。如果为 True,则使潜在的非确定性操作切换到确定性算法或引发运行时错误。如果为 False,则允许非确定性操作。
③警告:实际上这个设置对精度影响不大,影响精度在小数点后几位。如果不是对精度要求极高,其实不太建议修改,因为会使计算效率降低。确定性模式可能会对性能产生影响,具体取决于您的型号。

最后:

如果你想要进一步了解更多的相关知识,可以关注下面公众号联系~会不定期发布相关设计内容包括但不限于如下内容:信号处理、通信仿真、算法设计、matlab appdesigner,gui设计、simulink仿真......希望能帮到你!

5a8015ddde1e41418a38e958eb12ecbd.png

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐