It should sum up all the elements from an input vector and just divide each one by that sum. Assume all elements are positive.
You mean something like this?
NetGraph[
<|"norm" -> AggregationLayer[Total, 1],
"divide" -> ThreadingLayer[Divide, -1]|>,
{NetPort["Input"] -> "norm", {NetPort["Input"], "norm"} -> "divide"}
]
Yes, exactly! Thanks for your patience while I get up to speed.
Just for people who might need to try this some day: I needed a ramp layer, because otherwise the NN would sometimes give negative numbers for probabilities that were close to 0 and that would mess up the normalization and all the other probabilities.