INNER CODE UNIT · Python
bwd
taishi-i/nagisa · nagisa/dynet_loader.py:183
fwd, bwd = lstms[2 * layer], lstms[2 * layer + 1]
for tag, lstm in (('fwd', fwd), ('bwd', bwd)):
base = '%s[%d].%s' % (key, layer, tag)
_check_shape(base + '.Wx', lstm['Wx'], (4 * h, in_dim))
_check_shape(base + '.Wh', lstm['Wh'], (4 * h, h))
_check_shape(base + '.b', lstm['b'], (4 * h,))
pairs.append((fwd, bwd))
model[key] = pairs
for (name, arr), (key, shape) in zip(plain, [
('w_ws', (6, dim_hidden)), ('b_ws', (6,)),
('w_pos', (size_postags, dim_hidden)), ('b_pos', (size_postags,))]):
_check_shape(key + ' (%s)' % name, arr, shape)
model[key] = arr
for (name, arr), (key, shape) in zip(lookups, [
('UNI', (hp['VOCAB_SIZE_UNI'], dim_uni)),
('BI', (hp['VOCAB_SIZE_BI'], hp['DIM_BI'])),