mathLab / PINA

Physics-Informed Neural networks for Advanced modeling
https://mathlab.github.io/PINA/
MIT License
378 stars 65 forks source link

Failing ortho tests #328

Closed ndem0 closed 1 month ago

ndem0 commented 1 month ago

Describe the bug

_______________________________ test_forward[V2] _______________________________

V = tensor([[-2.2569e-01, -1.5197e-01, -1.2952e+00,  8.2365e-01, -1.3104e-02],
        [ 5.5923e-01, -1.9962e+00,  1.2643e...01, -1.1762e+00,  2.0898e-01,  6.8500e-03],
        [-4.8608e-01, -1.4008e-01,  1.9982e-01,  1.1502e+00,  1.2391e-02]])

    @pytest.mark.parametrize("V", list_matrices)
    def test_forward(V):
        orth = OrthogonalBlock()
        orth_row = OrthogonalBlock(0)
        V_orth = orth(V)
        V_orth_row = orth_row(V.T)
>       assert torch.allclose(V_orth.T @ V_orth, torch.eye(V.shape[1]), atol=1e-6)
E       assert False
E        +  where False = <built-in method allclose of type object at 0x7fb32ec67500>((tensor([[-0.1476,  0.3658, -0.4417,  0.7404, -0.3179],\n        [-0.0706, -0.9273, -0.2317,  0.2778, -0.0651],\n        ...0.0844],\n        [ 0.5195,  0.0561, -0.4283,  0.1318,  0.[72](https://github.com/mathLab/PINA/actions/runs/10421892539/job/29240913616?pr=327#step:5:73)54],\n        [-0.6357,  0.0179,  0.3517,  0.3323,  0.6012]]) @ tensor([[-0.1476, -0.0706, -0.5470,  0.5195, -0.6357],\n        [ 0.3658, -0.92[73](https://github.com/mathLab/PINA/actions/runs/10421892539/job/29240913616?pr=327#step:5:74),  0.0534,  0.0561,  0.0179],\n        ...0.3517],\n        [ 0.7404,  0.2778, -0.4968,  0.1318,  0.3323],\n        [-0.3179, -0.0651,  0.0844,  0.7254,  0.6012]])), tensor([[1., 0., 0., 0., 0.],\n        [0., 1., 0., 0., 0.],\n        [0., 0., 1., 0., 0.],\n        [0., 0., 0., 1., 0.],\n        [0., 0., 0., 0., 1.]]), atol=1e-06)
E        +    where <built-in method allclose of type object at 0x7fb32ec67500> = torch.allclose
E        +    and   tensor([[-0.1476,  0.3658, -0.4417,  0.[74](https://github.com/mathLab/PINA/actions/runs/10421892539/job/29240913616?pr=327#step:5:75)04, -0.3179],\n        [-0.0706, -0.9273, -0.2317,  0.2778, -0.0651],\n        ...0.0844],\n        [ 0.5195,  0.0561, -0.4283,  0.1318,  0.7254],\n        [-0.6357,  0.0179,  0.3517,  0.3323,  0.6012]]) = tensor([[-0.1476, -0.0706, -0.5470,  0.5195, -0.6357],\n        [ 0.3658, -0.9273,  0.0534,  0.0561,  0.0179],\n        ...0.3517],\n        [ 0.7404,  0.2778, -0.4968,  0.1318,  0.3323],\n        [-0.3179, -0.0651,  0.0844,  0.7254,  0.6012]]).T
E        +    and   tensor([[1., 0., 0., 0., 0.],\n        [0., 1., 0., 0., 0.],\n        [0., 0., 1., 0., 0.],\n        [0., 0., 0., 1., 0.],\n        [0., 0., 0., 0., 1.]]) = <built-in method eye of type object at 0x7fb32ec6[75](https://github.com/mathLab/PINA/actions/runs/10421892539/job/29240913616?pr=327#step:5:76)00>(5)
E        +      where <built-in method eye of type object at 0x7fb32ec67500> = torch.eye

tests/test_layers/test_orthogonal.py:24: AssertionError

To Reproduce PR #327

Additional context Only on Win3.11 and Ubuntu3.9

dario-coscia commented 1 month ago

Fixed in #332