Which formula is used to calculate the derivative of torch.where/torch.nonzero

You can find the derivative for torch.where here and for torch.nonzero here, which is not differentiable as its returning indices.