import torch


def safe_divide(input_tensor: torch.Tensor, other_tensor: torch.Tensor) -> torch.Tensor:
    """
    Divide input_tensor and other_tensor safely, set the output to zero where the divisor b is zero.

    Parameters
    ----------
    input_tensor : torch.Tensor
    other_tensor : torch.Tensor

    Returns
    -------
    torch.Tensor: the division.

    """

    data = torch.where(
        other_tensor == 0,
        torch.tensor([0.0], dtype=input_tensor.dtype).to(input_tensor.device),
        input_tensor / other_tensor,
    )
    return data