It is not clear to me what you want to do.
What do you mean by “resetting error states”? By “error memory stats” do you mean “incorrect memory stats”?
Are you saying that after an OOM error, torch.cuda.max_memory_allocated() returns a wrong value? If so, how do you know that this is a wrong value?