(cls, x, mprev, cprev, weights)
| 1502 | # Helper to construct a LSTM cell graph. |
| 1503 | @classmethod |
| 1504 | def LSTMCell(cls, x, mprev, cprev, weights): |
| 1505 | xm = array_ops.concat([x, mprev], 1) |
| 1506 | i_i, i_g, f_g, o_g = array_ops.split( |
| 1507 | value=math_ops.matmul(xm, weights), num_or_size_splits=4, axis=1) |
| 1508 | new_c = math_ops.sigmoid(f_g) * cprev + math_ops.sigmoid( |
| 1509 | i_g) * math_ops.tanh(i_i) |
| 1510 | new_c = math_ops.maximum(math_ops.minimum(new_c, 50.0), -50.0) |
| 1511 | new_m = math_ops.sigmoid(o_g) * math_ops.tanh(new_c) |
| 1512 | return new_m, new_c |
| 1513 | |
| 1514 | def _BuildForward(self, weights, inp, mode="cell"): |
| 1515 |
no test coverage detected