def METHOD_NAME(num: Tensor, denom: Tensor) -> Tensor:
    """Safe division, by preventing division by zero.
    Additionally casts to float if input is not already to secure backwards compatibility.
    """
    denom[denom == 0.0] = 1
    num = num if num.is_floating_point() else num.float()
    denom = denom if denom.is_floating_point() else denom.float()
    return num / denom