import torch


def _switch_component(
    x: torch.Tensor, ones: torch.Tensor, zeros: torch.Tensor
) -> torch.Tensor:
    """
    Basic component of switching functions.

    Args:
        x (torch.Tensor): Switch functions.
        ones (torch.Tensor): Tensor with ones.
        zeros (torch.Tensor): Zero tensor

    Returns:
        torch.Tensor: Output tensor.
    """
    x_ = torch.where(x <= 0, ones, x)
    return torch.where(x <= 0, zeros, torch.exp(-ones / x_))