From c6c13126354b88ff48b6e3f9addb78c4886b4e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jofre=20Vall=C3=A8s?= Date: Tue, 4 Jul 2023 11:34:32 +0200 Subject: [PATCH] Add tests --- test/Numerics_test.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/Numerics_test.jl b/test/Numerics_test.jl index 7a7eef3..f71c676 100644 --- a/test/Numerics_test.jl +++ b/test/Numerics_test.jl @@ -156,6 +156,18 @@ @test parent(C) ≈ C_ein end end + + @testset "multiple tensors" begin + A = Tensor(rand(2, 3, 4), (:i, :j, :k)) + B = Tensor(rand(4, 5, 3), (:k, :l, :j)) + C = Tensor(rand(5, 6, 2), (:l, :m, :i)) + D = Tensor(rand(6, 7, 2), (:m, :n, :i)) + + contracted = contract(A, B, C, D) + @test issetequal(labels(contracted), (:n, :i)) + @test issetequal(size(contracted), (7, 2)) + @test contracted ≈ contract(contract(contract(A, B), C), D) + end end @testset "qr" begin