yes, you call it as many times as you invoke the function.
Each of the SolveTrianguler functions will be a node in the autograd graph, so sharing them will end up overriding the saved_tensors of the first one etc…
Your snippet now looks correct.