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.

Hi,

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.cat([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,
torch.tensor[x1(t),x2(t),......,x50(t)]

And output will be
torch.tensor[x1(t+1),x2(t+1),......,x50(t+1)]

Then, the next input should be
torch.tensor[x1(t+1),x2(t+1),......,x50(t+1)]
(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.
torch.tensor[x51(t),x52(t),x53(t)]

Thank you for your attention.

1 Like