Computes the LSTM cell forward propagation for all the time steps.
tf.raw_ops.BlockLSTM( seq_len_max, x, cs_prev, h_prev, w, wci, wcf, wco, b, forget_bias=1, cell_clip=3, use_peephole=False, name=None )
This is equivalent to applying LSTMBlockCell in a loop, like so:
for x1 in unpack(x): i1, cs1, f1, o1, ci1, co1, h1 = LSTMBlock( x1, cs_prev, h_prev, w, wci, wcf, wco, b) cs_prev = cs1 h_prev = h1 i.append(i1) cs.append(cs1) f.append(f1) o.append(o1) ci.append(ci1) co.append(co1) h.append(h1) return pack(i), pack(cs), pack(f), pack(o), pack(ci), pack(ch), pack(h)
Args | |
---|---|
seq_len_max | A Tensor of type int64 . Maximum time length actually used by this input. Outputs are padded with zeros beyond this length. |
x | A Tensor . Must be one of the following types: half , float32 . The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). |
cs_prev | A Tensor . Must have the same type as x . Value of the initial cell state. |
h_prev | A Tensor . Must have the same type as x . Initial output of cell (to be used for peephole). |
w | A Tensor . Must have the same type as x . The weight matrix. |
wci | A Tensor . Must have the same type as x . The weight matrix for input gate peephole connection. |
wcf | A Tensor . Must have the same type as x . The weight matrix for forget gate peephole connection. |
wco | A Tensor . Must have the same type as x . The weight matrix for output gate peephole connection. |
b | A Tensor . Must have the same type as x . The bias vector. |
forget_bias | An optional float . Defaults to 1 . The forget gate bias. |
cell_clip | An optional float . Defaults to 3 . Value to clip the 'cs' value to. |
use_peephole | An optional bool . Defaults to False . Whether to use peephole weights. |
name | A name for the operation (optional). |
Returns | |
---|---|
A tuple of Tensor objects (i, cs, f, o, ci, co, h). | |
i | A Tensor . Has the same type as x . |
cs | A Tensor . Has the same type as x . |
f | A Tensor . Has the same type as x . |
o | A Tensor . Has the same type as x . |
ci | A Tensor . Has the same type as x . |
co | A Tensor . Has the same type as x . |
h | A Tensor . Has the same type as x . |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/BlockLSTM