Skip to content

Instantly share code, notes, and snippets.

@Oktai15
Last active April 30, 2018 11:23
Show Gist options
  • Save Oktai15/05048100a1a1d239d0ee28f5f645fb2b to your computer and use it in GitHub Desktop.
Save Oktai15/05048100a1a1d239d0ee28f5f645fb2b to your computer and use it in GitHub Desktop.
PyTorch: simple example of recurrent block
import torch
h0 = torch.randn(10)
x = torch.randn(5, 10)
h = [h0]
for i in range(5):
h_i = h[-1] * x[i]
h.append(h_i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment