# Generating montonically increasing sequence

Hello,

I have a requirement that my neural network output should produce a floating-point sequence that is monotonically increasing i.e. something like below:

output = [0.01, 0.05, 0.1, 0.2, 0.3, 0.7, 0.9, 1.0]

Is there any way that I can implement this requirement in PyTorch? Assuming I am using RNN based neural network.

This requirement in itself doesn’t make much sense. What is the input of your network and what are the predictions?

There’s no need for a neural network to create a sequence of monotonically increasing floats

map outputs to positive domain (e.g. softplus(rnn_output)) and treat them as deltas: outputs=cumsum(deltas, dim=timedim)

Hi Alex,

Thanks for your kind reply, Can you explain, What do you mean by treat them as deltas? Please.

differencing, y[t] = y[t-1] + delta, with cumsum you “integrate” deltas back