AlphaBetaGamma96:

A silly question, but are you reading the THPFunction_apply, <omitting python frames>, at::Tensor::mul backward? from frame #24 to frame #14?


Yes.
And these frames, contrary to the python ones are in reverse order. So the line below is the top level function, and the line above is the function that was called.

Weirdly enough, it seems that on the 4th time calling CustomDeterminantBackward.backward() messes up what’s seen in CustomDeterminantBackward.forward(), but only on the final item in the batch.

It is indeed surprising.
I am wondering, why is the batch size never present in these sizes that you print? Is there an outer loop that extract each element of the batch? Maybe this one is doing something funky?