I built my loss function using conditional statement like:
def myloss(data):
    if blah blah:
        loss = blah
    if blah blah:
        loss = blah
    return loss
loss = myloss(output)
loss.backward()

I worried it won’t work but it worked.
but how can my loss function be backpropagated?
Is my loss function differentiable?
Thank you for helping me in advance.