MCPcopy Create free account
hub / github.com/pytorch/pytorch / LSTMWithAttentionCell

Class LSTMWithAttentionCell

caffe2/python/rnn_cell.py:1389–1426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1387
1388
1389class 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
1429class MILSTMWithAttentionCell(AttentionCell):

Callers 1

LSTMWithAttentionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…