Input(t) = output(t-1) without "for"

This question was updated, I write in following comment .

I want to make RNN to be as follow
input(t) = output(t-1)

In pytorch’s RNN, the time series data, the input are generally obvious from the beginning.
But this case isn’t because the input depend on its output.
So, I think, There are only way to do this is for statement in this case,
but I also know that for statement in python is too slow,
and this is the reason why I’m thinking to be used PyTorch.

Is there any ideas?
Thank you for reading.


It is not very clear from your question what kind of objects input and output are. But adding an extra entry at the beginning will do this: [None,] + output for a list for example. Or[torch.tensor(whatever_is_the_right_size), output], 0) for Tensors.

Thank you and sorry for the unclear question.
I will update my question.

This is the algorism what I want to create.

There are one layler RNN, called Reservoir computing
like this,
Recent advances in physical reservoir computing: A review

In my case, for example, I want this network to work like below,
This is the input,

And output will be

Then, the next input should be
(equal to the before output.)

If it goes, there are no input from external, so the following external inputs are separately given as triggers to drive this network.

Thank you for your attention.

1 Like