I try to create a custom loss function in a differentiable manner. For example I have two tensors:
a = [2, 8, 9, 10, 2] and b = [1, 2, 6, 7, 8] and my loss function should penalize a - b when a - b is positive.
if I write loss function as follows, I think it is not differentiable, because of “<” operation.
diff = a - b diff[ diff < 0 ] = 0 return diff
How can I create this loss function in a differentiable manner?
Thanks in advance.