If the code's algorithm is patented, you cannot get around the patent by using different function and variable names and perturbing the code organization.
I bet you're correct and we wont be able to use ML models to strip code of its patents the way we use them to strip code of its copyright protection. But I wouldn't have expected the copyright stripping trick to work either, yet here we are.
You can disguise borrowed code such that, in the first place, nobody will suspect that it's derived from anything, and even then, they won't have evidence that it's derived.
Changing a few names and superficial organization details, on a large and significant work, will likely not fool anyone.
If it's a small module or just one function, quite probably easily so. You don't even have to understand how the code works; if you just know the paper from where the original author got the code, you can just say you implemented the detailed requirements there and validated it on the available test vectors.