I essentiall have something like this:
class CustomClass(nn.Module):
    def forward(input):
         (do some calculations)
        return l_1, logdets

l_1 gets used immediatly in the next layer and I want to disable the gradient from logdets if it’s greater than zero.