Run the cell and add its inputs to its outputs. Args: inputs: cell inputs. state: cell state. scope: optional cell scope. Returns: Tuple of cell outputs and new state. Raises: TypeError: If cell inputs and outputs have different structure (type). Va
(self, inputs, state, scope=None)
| 1313 | return inp * carry + out * transform |
| 1314 | |
| 1315 | def __call__(self, inputs, state, scope=None): |
| 1316 | """Run the cell and add its inputs to its outputs. |
| 1317 | |
| 1318 | Args: |
| 1319 | inputs: cell inputs. |
| 1320 | state: cell state. |
| 1321 | scope: optional cell scope. |
| 1322 | |
| 1323 | Returns: |
| 1324 | Tuple of cell outputs and new state. |
| 1325 | |
| 1326 | Raises: |
| 1327 | TypeError: If cell inputs and outputs have different structure (type). |
| 1328 | ValueError: If cell inputs and outputs have different structure (value). |
| 1329 | """ |
| 1330 | outputs, new_state = self._cell(inputs, state, scope=scope) |
| 1331 | nest.assert_same_structure(inputs, outputs) |
| 1332 | |
| 1333 | # Ensure shapes match |
| 1334 | def assert_shape_match(inp, out): |
| 1335 | inp.get_shape().assert_is_compatible_with(out.get_shape()) |
| 1336 | |
| 1337 | nest.map_structure(assert_shape_match, inputs, outputs) |
| 1338 | res_outputs = nest.map_structure(self._highway, inputs, outputs) |
| 1339 | return (res_outputs, new_state) |
| 1340 | |
| 1341 | |
| 1342 | class LayerNormBasicLSTMCell(rnn_cell_impl.RNNCell): |