@@ -1812,10 +1812,10 @@ def _test_matmul(i, j, k, dtype, outer=None):
1812
1812
A_np = np .random .uniform (high = 5.0 , size = A_shape ).astype (dtype )
1813
1813
B_np = np .random .uniform (high = 5.0 , size = B_shape ).astype (dtype )
1814
1814
compare_tf_with_tvm (
1815
- [A_np , B_np ], [A .name , B .name ], result .name , {"use_dense" : True }
1815
+ [A_np , B_np ], [A .name , B .name ], result .name , convert_config = {"use_dense" : True }
1816
1816
)
1817
1817
compare_tf_with_tvm (
1818
- [A_np , B_np ], [A .name , B .name ], result .name , {"use_dense" : False }
1818
+ [A_np , B_np ], [A .name , B .name ], result .name , convert_config = {"use_dense" : False }
1819
1819
)
1820
1820
1821
1821
@@ -1835,10 +1835,16 @@ def _test_batch_matmul(A_shape, B_shape, dtype, adjoint_a=False, adjoint_b=False
1835
1835
A_np = np .random .uniform (high = 5.0 , size = A_shape ).astype (dtype )
1836
1836
B_np = np .random .uniform (high = 5.0 , size = B_shape ).astype (dtype )
1837
1837
compare_tf_with_tvm (
1838
- [A_np , B_np ], [A .name , B .name ], result .name , {"use_nt_batch_matmul" : True }
1838
+ [A_np , B_np ],
1839
+ [A .name , B .name ],
1840
+ result .name ,
1841
+ convert_config = {"use_nt_batch_matmul" : True },
1839
1842
)
1840
1843
compare_tf_with_tvm (
1841
- [A_np , B_np ], [A .name , B .name ], result .name , {"use_nt_batch_matmul" : False }
1844
+ [A_np , B_np ],
1845
+ [A .name , B .name ],
1846
+ result .name ,
1847
+ convert_config = {"use_nt_batch_matmul" : False },
1842
1848
)
1843
1849
1844
1850
@@ -1852,10 +1858,23 @@ def _test_batch_matmul_dynamic(
1852
1858
1853
1859
A_np = np .random .uniform (high = 5.0 , size = A_np_shape ).astype (dtype )
1854
1860
B_np = np .random .uniform (high = 5.0 , size = B_np_shape ).astype (dtype )
1855
- # for now, in TOPI, only cublas's implementation support dynamic shape
1861
+ # for now, in TOPI, only llvm & cublas's implementation support dynamic shape
1856
1862
# TODO add more backends support in TOPI
1857
1863
compare_tf_with_tvm (
1858
- [A_np , B_np ], [A .name , B .name ], result .name , mode = "vm" , targets = ["cuda -libs=cublas" ]
1864
+ [A_np , B_np ],
1865
+ [A .name , B .name ],
1866
+ result .name ,
1867
+ mode = "vm" ,
1868
+ targets = ["llvm" , "cuda -libs=cublas" ],
1869
+ convert_config = {"use_nt_batch_matmul" : True },
1870
+ )
1871
+ compare_tf_with_tvm (
1872
+ [A_np , B_np ],
1873
+ [A .name , B .name ],
1874
+ result .name ,
1875
+ mode = "vm" ,
1876
+ targets = ["llvm" , "cuda -libs=cublas" ],
1877
+ convert_config = {"use_nt_batch_matmul" : False },
1859
1878
)
1860
1879
1861
1880
@@ -1874,7 +1893,6 @@ def test_forward_batch_matmul():
1874
1893
_test_batch_matmul ((1 , 8 , 64 ), (64 , 1 ), "float32" , False , False )
1875
1894
1876
1895
1877
- @tvm .testing .requires_cuda
1878
1896
def test_forward_batch_matmul_dynamic ():
1879
1897
_test_batch_matmul_dynamic ((None , 5 , 4 ), (None , 4 , 5 ), (3 , 5 , 4 ), (3 , 4 , 5 ), "int32" )
1880
1898
_test_batch_matmul_dynamic (
0 commit comments