@@ -719,6 +719,10 @@ def test_einsum_error1(self):
719719 # different size for same label 5 != 4
720720 assert_raises (ValueError , inp .einsum , "ii" , a )
721721
722+ a = inp .arange (25 ).reshape (5 , 5 )
723+ # subscript is not within the valid range [0, 52)
724+ assert_raises (ValueError , inp .einsum , a , [53 , 53 ])
725+
722726 @pytest .mark .parametrize ("do_opt" , [True , False ])
723727 @pytest .mark .parametrize ("xp" , [numpy , inp ])
724728 def test_einsum_error2 (self , do_opt , xp ):
@@ -1740,6 +1744,17 @@ def test_output_order(self):
17401744 tmp = inp .einsum ("...ft,mf->...mt" , d , c , order = "a" , optimize = opt )
17411745 assert tmp .flags .c_contiguous
17421746
1747+ def test_einsum_path (self ):
1748+ # Test einsum path for covergae
1749+ a = numpy .random .rand (1 , 2 , 3 , 4 )
1750+ b = numpy .random .rand (4 , 3 , 2 , 1 )
1751+ a_dp = inp .array (a )
1752+ b_dp = inp .array (b )
1753+ expected = numpy .einsum_path ("ijkl,dcba->dcba" , a , b )
1754+ result = inp .einsum_path ("ijkl,dcba->dcba" , a_dp , b_dp )
1755+ assert expected [0 ] == result [0 ]
1756+ assert expected [1 ] == result [1 ]
1757+
17431758
17441759class TestInv :
17451760 @pytest .mark .parametrize (
0 commit comments