Ejemplo n.º 1
0
def test_from_matrix():
    C_good = SO2.from_matrix(torch.eye(2))
    print(C_good.mat)

    print(SO2.is_valid_matrix(C_good.mat))

    C_bad = SO2.from_matrix(torch.eye(2).add_(1e-3), normalize=True)
    print(isinstance(C_bad, SO2))
    print(C_bad.mat)
Ejemplo n.º 2
0
def test_from_matrix():
    C_good = SO2.from_matrix(torch.eye(2))
    assert isinstance(C_good, SO2) \
        and C_good.mat.dim() == 2 \
        and C_good.mat.shape == (2, 2) \
        and SO2.is_valid_matrix(C_good.mat).all()

    C_bad = SO2.from_matrix(torch.eye(2).add_(1e-3), normalize=True)
    assert isinstance(C_bad, SO2) \
        and C_bad.mat.dim() == 2 \
        and C_bad.mat.shape == (2, 2) \
        and SO2.is_valid_matrix(C_bad.mat).all()
Ejemplo n.º 3
0
def test_from_matrix_batch():
    C_good = SO2.from_matrix(torch.eye(2).repeat(5, 1, 1))
    assert isinstance(C_good, SO2) \
        and C_good.mat.dim() == 3 \
        and C_good.mat.shape == (5, 2, 2) \
        and SO2.is_valid_matrix(C_good.mat).all()

    C_bad = copy.deepcopy(C_good.mat)
    C_bad[3].add_(0.1)
    C_bad = SO2.from_matrix(C_bad, normalize=True)
    assert isinstance(C_bad, SO2) \
        and C_bad.mat.dim() == 3 \
        and C_bad.mat.shape == (5, 2, 2) \
        and SO2.is_valid_matrix(C_bad.mat).all()