Noise with gradient works!

And what I’m saying is that based on the code you provided, you should not expect it to work in general, because differentiating through noise is undefined behavior in the majority of cases