Is there a way to impose a constraint on the output of a Flux neural network model?

I think that the most usual approach to impose such constraints are to use appropriate nonlinearity. In case of strict positive output, i would use softplus log(1+exp(x)).

5 Likes