MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_rnn_cell

Function test_rnn_cell

imperative/python/test/unit/module/test_rnn.py:22–30  ·  view source on GitHub ↗
(batch_size, input_size, hidden_size, init_hidden)

Source from the content-addressed store, hash-verified

20 [(3, 10, 20, True), (3, 10, 20, False), (1, 10, 20, False)],
21)
22def test_rnn_cell(batch_size, input_size, hidden_size, init_hidden):
23 rnn_cell = RNNCell(input_size, hidden_size)
24 x = mge.random.normal(size=(batch_size, input_size))
25 if init_hidden:
26 h = F.zeros(shape=(batch_size, hidden_size))
27 else:
28 h = None
29 h_new = rnn_cell(x, h)
30 assert_tuple_equal(h_new.shape, (batch_size, hidden_size))
31
32
33@pytest.mark.skipif(get_device_count("gpu") > 0, reason="no algorithm on cuda")

Callers

nothing calls this directly

Calls 4

RNNCellClass · 0.90
assert_tuple_equalFunction · 0.85
normalMethod · 0.80
zerosMethod · 0.45

Tested by

no test coverage detected