Implementing softmax() in C
Prefer double to float for calculations

Unless you're extremely constrained for space, or you have a platform with software floating-point (or very poor FP hardware), there's no reason to use float.

Reduce the scope of index variable

Modern C allows us to declare i local to the loops:

for (int i = 0;  i &lt; input_len;  i++)


Hoist the log(sum) calculation

Your compiler's optimizer will probably spot that log(sum) does not change, but why not help it?

const double log_sum = log(sum);
for (int i = 0;  i &lt; input_len;  i++) {
    input[i] = expf(input[i] - m - log_sum);
}


In fact, since m is also constant, we should hoist that, too:

const double scale = m + log(sum);
for (int i = 0;  i &lt; input_len;  i++) {
    input[i] = expf(input[i] - scale);
}