def list.softmax
import bend-ml-llama@0.2.1.0/main.bend as BendMlLlamaimport Base
353# stable softmax: subtracts the maximum before exponentiating
354def list.softmax(+xs: List<&2, F32>) -> List<&2, F32>:
355 list.softmax.fin(list.exp_shift(xs, list.max(xs)))