def __init__(self, num_units, num_cores, forget_bias=1.0, timestep=0):
"""Initialize the basic LSTM cell.
Args:
num_units: int, The number of units in the LSTM cell.
num_cores: int, The number of partitions (cores) in the LSTM state.
forget_bias: float, The bias added to forget gates (see above).
"""
self._num_units = num_units
self._forget_bias = forget_bias
# additional variables
self._cores = tf.constant(num_cores)
self._timestep = tf.Variable(timestep) # assign to 0 then terminal (or epoch)
self.reset_timestep = tf.assign(self._timestep, 0)
# auxiliary operators
dilated_mask, hold_mask = self._get_mask(num_cores)
self._dilated_mask = tf.constant(dilated_mask, dtype=tf.float32)
self._hold_mask = tf.constant(hold_mask, dtype=tf.float32)
评论列表
文章目录