Description
Currently the only signature available is (vector) => vector
But it's somewhat annoying when I want to do this row-wise over a matrix. (To hand-code a similar effect as stochastic_row_matrix
constraint has)
I suggest adding the following signatures:
Softmax for row_vector
s:
(row_vector) => row_vector
And a 'vectorized' variant:
(array[] vector) => array[] vector
(array[] row_vector) => array[] row_vector
The signature (matrix) => matrix
is perhaps not a good idea because it's not immediately clear which dimension it should work over, but maybe there could be pairs of functions softmax_rowwise
, softmax_columnwise
(which would essentially return stochastic_row_matrix
and stochastic_col_matrix
respectively) as well as the log variants log_softmax_rowwise
, log_softmax_colwise
.
Possibly related: stan-dev/stan#3331