logsumexp exists to tackle this case using identity:
log(exp(a)+exp(b)) = c + log(exp(a-c) + exp(b-c))
c=max(a,b)
You can adapt this for scaling and mean with: K*exp(a) = exp(log(K))*exp(a) = exp(a+log(K))
Or just use .clamp() on problematic tensors.