import torch


def sig(gain: float, offset: float, x: torch.Tensor) -> torch.Tensor:
    """Computes element-wise sigmoid function.

    Args:
      gain: The sigmoid function gain.
      offset: The sigmoid function offset.

    Returns:
      The sigmoid function evaluated for each element in the tensor.

    """
    return 1 / (1 + (offset * (1 - x) / x)**gain)