Torch.backends.cudnn.enabled = False

So, what’s the corresponding code in C++?

I suffer from different results between cpu and gpu…

at::globalContext().setBenchmarkCuDNN(flag) should work in C++.
However, benchmark is off by default so I guess that’s not the root cause of the non-deterministic results.
You could try to use at::globalContext().deterministicCuDNN() or at::globalContext().setDeterministic() in the nightly binaries and refer to this document for more information.

1 Like