I am using a mask based on comparison:
def combine_images(target, x, y):
    diff1 = torch.abs(target - x)
    diff2 = torch.abs(target - y)
    mask = (diff1 < diff2).float()
    target_new = x * mask + y * (1 - mask)
    return target_new

My question is that is this function differentiable since it includes a type conversion .float()? Thanks.