Example #1
0
def test_inv(ch):
    torch.manual_seed(100)
    X = ComplexTensor(torch.rand(2, 3, ch, ch), torch.rand(2, 3, ch, ch))
    X = X + X.conj().transpose(-1, -2)
    assert FC.allclose(ComplexTensor(np.linalg.inv(X.numpy())),
                       inv(X),
                       atol=1e-4)
def test_trace():
    t = ComplexTensor(_get_complex_array(10, 10))
    x = numpy.trace(t.numpy())
    y = F.trace(t).numpy()
    numpy.testing.assert_allclose(x, y)