Skip to content

Commit c480d4e

Browse files
committed
remove fflayers
1 parent 86e5c4b commit c480d4e

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

code/lstm.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,6 @@ def get_layer(name):
115115
return fns
116116

117117

118-
def param_init_fflayer(options, params, prefix='ff'):
119-
weights = numpy.random.randn(options['dim_proj'], options['dim_proj'])
120-
biases = numpy.zeros((options['dim_proj'], ))
121-
params[_p(prefix, 'W')] = 0.01 * weights.astype('float32')
122-
params[_p(prefix, 'b')] = biases.astype('float32')
123-
124-
return params
125-
126-
127-
def fflayer(tparams, state_below, options, prefix='ff', **kwargs):
128-
pre_act = (tensor.dot(state_below,
129-
tparams[_p(prefix, 'W')]) + tparams[_p(prefix, 'b')])
130-
return options['activ'](pre_act)
131-
132-
133118
def ortho_weight(ndim):
134119
W = numpy.random.randn(ndim, ndim)
135120
u, s, v = numpy.linalg.svd(W)
@@ -202,8 +187,7 @@ def _step(m_, x_, h_, c_):
202187

203188
# ff: Feed Forward (normal neural net), only useful to put after lstm
204189
# before the classifier.
205-
layers = {'ff': (param_init_fflayer, fflayer),
206-
'lstm': (param_init_lstm, lstm_layer)}
190+
layers = {'lstm': (param_init_lstm, lstm_layer)}
207191

208192

209193
def sgd(lr, tparams, grads, x, mask, y, cost):
@@ -382,7 +366,6 @@ def test_lstm(
382366
patience=10, # number of epoch to wait before early stop if no progress
383367
max_epochs=5000, # The maximum number of epoch to run
384368
dispFreq=10, # display to stdout the training progress every N updates
385-
activ=tensor.tanh, # The activation function from Theano.
386369
decay_c=0., # weight decay for the classifier applied to the U weights.
387370
lrate=0.0001, # learning rate for sgd (not used for adadelta and rmsprop)
388371
n_words=10000, # vocabulary size

0 commit comments

Comments
 (0)