Skip to content

LSTMCell

source

LSTMCell(
   input_layer, n_units, previous_state = None, activation = tf.tanh,
   gate_activation = tf.sigmoid, bias_init = tf.initializers.zeros(),
   forget_bias_init = tf.initializers.ones(),
   w_init = tf.initializers.glorot_uniform(),
   u_init = tf.initializers.glorot_uniform(), w_dropconnect = None,
   u_dropconnect = None, x_dropout = None, r_dropout = None, y_dropout = None,
   dropout_locked = True, regularized = False, share_state_with = None,
   name = 'lstm_cell'
)

A long short-term memory (LSTM) cell.

Args

  • input_layer (Layer) : input sequence layer in time-major order
  • previous_state (Optional[Tuple[Layer]]) : (prev_h, prev_mem) previous_memory is the memory state output for the previous cell or None if the current cell is the first step

Methods:

.init_state

source

.init_state()

.compute

source

.compute(
   input_tensor, *previous_state
)

compute layer value based on input Tensor values

Args

  • input_tensor : a Tensor or Layer input to the current cell
  • previous_state : (previous_h, previous_memory)

Returns

  • a tensor with the cell's output

.reuse_with

source

.reuse_with(
   input_layer, *previous_state, regularized = None, name = None
)