(target: Tensor, source: float or Tensor, epsilon=1e-5)
return target * (source_total / denominator)
Multiplies the target so that its sum matches the source.

    Args:
        target: `Tensor`
        source: `Tensor` or constant
        epsilon: Small number to prevent division by zero.

    Returns:
        Normalized tensor of the same shape as target
Multiplies the target so that its sum matches the source.
Multiplies the target so that its sum matches the source .
def normalize_to(target: Tensor, source: float or Tensor, epsilon=1e-5):
    """
    Multiplies the target so that its sum matches the source.

    Args:
        target: `Tensor`
        source: `Tensor` or constant
        epsilon: Small number to prevent division by zero.

    Returns:
        Normalized tensor of the same shape as target
    """
    target_total = math.sum_(target)
    denominator = math.maximum(target_total, epsilon) if epsilon is not None else target_total
    source_total = math.sum_(source)
    return target * (source_total / denominator)
def normalize_to ( target : Tensor , source : float or Tensor , epsilon = 1e-5 ) : target_total = math . sum_ ( target ) denominator = math . maximum ( target_total , epsilon ) if epsilon is not None else target_total source_total = math . sum_ ( source ) return target * ( source_total / denominator )