public final class
BlockLSTMV2
Computes the LSTM cell forward propagation for all the time steps.
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)
Note that unlike LSTMBlockCell (and BlockLSTM) which uses ICFO gate layout,
this op uses IFCO. So in order for the following snippet to be equivalent
all gate-related outputs should be reordered.
Nested Classes
class | BlockLSTMV2.Options | Optional attributes for BlockLSTMV2
|
Public Methods
static BlockLSTMV2.Options |
cellClip(Float cellClip)
|
Output<T> |
ci()
The cell input over the whole time sequence.
|
Output<T> |
co()
The cell after the tanh over the whole time sequence.
|
static <T extends Number> BlockLSTMV2<T> | |
Output<T> |
cs()
The cell state before the tanh over the whole time sequence.
|
Output<T> |
f()
The forget gate over the whole time sequence.
|
Output<T> |
h()
The output h vector over the whole time sequence.
|
Output<T> |
i()
The input gate over the whole time sequence.
|
Output<T> |
o()
The output gate over the whole time sequence.
|
static BlockLSTMV2.Options |
usePeephole(Boolean usePeephole)
|
Inherited Methods
Public Methods
public static BlockLSTMV2.Options cellClip (Float cellClip)
Parameters
cellClip | Value to clip the 'cs' value to. |
---|
public static BlockLSTMV2<T> create (Scope scope, Operand<Long> seqLenMax, Operand<T> x, Operand<T> csPrev, Operand<T> hPrev, Operand<T> w, Operand<T> wci, Operand<T> wcf, Operand<T> wco, Operand<T> b, Options... options)
Factory method to create a class wrapping a new BlockLSTMV2 operation.
Parameters
scope | current scope |
---|---|
seqLenMax | Maximum time length actually used by this input. Outputs are padded with zeros beyond this length. |
x | The sequence input to the LSTM, shape (timelen, batch_size, num_inputs). |
csPrev | Value of the initial cell state. |
hPrev | Initial output of cell (to be used for peephole). |
w | The weight matrix. |
wci | The weight matrix for input gate peephole connection. |
wcf | The weight matrix for forget gate peephole connection. |
wco | The weight matrix for output gate peephole connection. |
b | The bias vector. |
options | carries optional attributes values |
Returns
- a new instance of BlockLSTMV2
public static BlockLSTMV2.Options usePeephole (Boolean usePeephole)
Parameters
usePeephole | Whether to use peephole weights. |
---|