Skip to content

Instantly share code, notes, and snippets.

View dmus's full-sized avatar

Derk Mus dmus

  • Amsterdam, Netherlands
  • 12:59 (UTC -12:00)
  • LinkedIn in/derkmus
View GitHub Profile
@dmus
dmus / sample.lua
Created October 19, 2016 12:47
Sample
require 'nn'
require 'torch'
require 'rnn'
require 'gnuplot'
-- the input data is: x[i]=i (i=1..1000)
data = torch.Tensor(1001):range(1,1001):apply(math.rad):apply(math.sin)
lstm = torch.load('rnn_sine.t7')
local N = 50 -- number of steps to sample
@dmus
dmus / train.lua
Created October 19, 2016 12:46
LSTM train
require 'nn'
require 'torch'
require 'rnn'
require 'gnuplot'
require 'optim'
--debugger = require('fb.debugger')
no_param = 1 -- number of parameters in one element. In case of x->sin(x) this is 1.
seq_length = 50 -- length of the sequence (number of Tensors in the table fed to nn.Sequencer())
batch_size = 10 -- size of the batches