| 1387 | |
| 1388 | |
| 1389 | class LSTMWithAttentionCell(AttentionCell): |
| 1390 | |
| 1391 | def __init__( |
| 1392 | self, |
| 1393 | encoder_output_dim, |
| 1394 | encoder_outputs, |
| 1395 | encoder_lengths, |
| 1396 | decoder_input_dim, |
| 1397 | decoder_state_dim, |
| 1398 | name, |
| 1399 | attention_type, |
| 1400 | weighted_encoder_outputs, |
| 1401 | forget_bias, |
| 1402 | lstm_memory_optimization, |
| 1403 | attention_memory_optimization, |
| 1404 | forward_only=False, |
| 1405 | ): |
| 1406 | decoder_cell = LSTMCell( |
| 1407 | input_size=decoder_input_dim, |
| 1408 | hidden_size=decoder_state_dim, |
| 1409 | forget_bias=forget_bias, |
| 1410 | memory_optimization=lstm_memory_optimization, |
| 1411 | name='{}/decoder'.format(name), |
| 1412 | forward_only=False, |
| 1413 | drop_states=False, |
| 1414 | ) |
| 1415 | super().__init__( |
| 1416 | encoder_output_dim=encoder_output_dim, |
| 1417 | encoder_outputs=encoder_outputs, |
| 1418 | encoder_lengths=encoder_lengths, |
| 1419 | decoder_cell=decoder_cell, |
| 1420 | decoder_state_dim=decoder_state_dim, |
| 1421 | name=name, |
| 1422 | attention_type=attention_type, |
| 1423 | weighted_encoder_outputs=weighted_encoder_outputs, |
| 1424 | attention_memory_optimization=attention_memory_optimization, |
| 1425 | forward_only=forward_only, |
| 1426 | ) |
| 1427 | |
| 1428 | |
| 1429 | class MILSTMWithAttentionCell(AttentionCell): |
no outgoing calls
no test coverage detected
searching dependent graphs…