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

Function test_stack

test/espnet2/enh/layers/test_complex_utils.py:171–185  ·  view source on GitHub ↗
(dim)

Source from the content-addressed store, hash-verified

169
170@pytest.mark.parametrize("dim", [0, 1, 2])
171def test_stack(dim):
172 if is_torch_1_9_plus:
173 wrappers = [ComplexTensor, torch.complex]
174 modules = [FC, torch]
175 else:
176 wrappers = [ComplexTensor]
177 modules = [FC]
178
179 for complex_wrapper, complex_module in zip(wrappers, modules):
180 print(complex_wrapper, complex_module)
181 mat1 = complex_wrapper(torch.rand(2, 3, 4), torch.rand(2, 3, 4))
182 mat2 = complex_wrapper(torch.rand(2, 3, 4), torch.rand(2, 3, 4))
183 ret = stack([mat1, mat2], dim=dim)
184 ret2 = complex_module.stack([mat1, mat2], dim=dim)
185 assert complex_module.allclose(ret, ret2)
186
187
188def test_complex_impl_consistency():

Callers

nothing calls this directly

Calls 1

stackFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…