MCPcopy Create free account
hub / github.com/espnet/espnet / test_RNNDecoder_backward

Function test_RNNDecoder_backward

test/espnet2/asr/decoder/test_rnn_decoder.py:10–17  ·  view source on GitHub ↗
(context_residual, rnn_type)

Source from the content-addressed store, hash-verified

8@pytest.mark.parametrize("context_residual", [True, False])
9@pytest.mark.parametrize("rnn_type", ["lstm", "gru"])
10def test_RNNDecoder_backward(context_residual, rnn_type):
11 decoder = RNNDecoder(10, 12, context_residual=context_residual, rnn_type=rnn_type)
12 x = torch.randn(2, 9, 12)
13 x_lens = torch.tensor([9, 7], dtype=torch.long)
14 t = torch.randint(0, 10, [2, 4], dtype=torch.long)
15 t_lens = torch.tensor([4, 3], dtype=torch.long)
16 z_all, ys_in_lens = decoder(x, x_lens, t, t_lens)
17 z_all.sum().backward()
18
19
20@pytest.mark.parametrize("context_residual", [True, False])

Callers

nothing calls this directly

Calls 2

RNNDecoderClass · 0.90
backwardMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…