INNER CODE UNIT · Python
LSTMCell
ematvey/hierarchical-attention-networks · bn_lstm.py:13
class LSTMCell(RNNCell):
"""Vanilla LSTM implemented with same initializations as BN-LSTM"""
def __init__(self, num_units):
self.num_units = num_units
@property
def state_size(self):
return (self.num_units, self.num_units)
@property
def output_size(self):
return self.num_units
def __call__(self, x, state, scope=None):
with tf.variable_scope(scope or type(self).__name__):
c, h = state
# Keep W_xh and W_hh separate here as well to reuse initialization methods