From f73a1f641680e61d2e4a0a081a98f01b7fca9689 Mon Sep 17 00:00:00 2001 From: Leandro Nunes Date: Fri, 9 Oct 2020 17:10:23 +0100 Subject: [PATCH] [TEST][TEDD] improve TEDD tests to also run on CPU Docker image. (#6643) * Amend regular expressions to match with what is being reported by CPU Docker image Graphviz * Fix typo on dependency checking function * Organise imports --- tests/python/contrib/test_tedd.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/python/contrib/test_tedd.py b/tests/python/contrib/test_tedd.py index 03e063ec97da..373fb14d369f 100644 --- a/tests/python/contrib/test_tedd.py +++ b/tests/python/contrib/test_tedd.py @@ -14,9 +14,9 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -from tvm import te -import numpy as np import re + +from tvm import te from tvm import topi @@ -25,7 +25,7 @@ def findany(pattern, str): assert len(matches) > 0, "Pattern not found.\nPattern: " + pattern + "\nString: " + str -def checkdepdency(): +def checkdependency(): import pkg_resources return not {"graphviz", "ipython"} - {pkg.key for pkg in pkg_resources.working_set} @@ -55,7 +55,7 @@ def verify(): findany(r"Tensor_3_0 -> Stage_4:I_1", str) findany(r"Stage_4:O_0 -> Tensor_4_0", str) - if checkdepdency(): + if checkdependency(): verify() @@ -79,8 +79,8 @@ def verify(): findany(r"subgraph cluster_Stage_0", str) findany(r"subgraph cluster_Stage_1", str) # Check itervars and their types - findany(r"i\(kDataPar\)\
range\(min=0, ext=n\)", str) - findany(r"k\(kCommReduce\)\
range\(min=0, ext=m\)", str) + findany(r"\(kDataPar\)\
range\(min=0, ext=n\)", str) + findany(r"\(kCommReduce\)\
range\(min=0, ext=m\)", str) # Check the split node findany(r"Split_Relation_1_0 +.+\>Split", str) # Check all edges to/from the split node @@ -88,7 +88,7 @@ def verify(): findany(r"Split_Relation_1_0:Outer -> IterVar_1_2:itervar", str) findany(r"Split_Relation_1_0:Inner -> IterVar_1_3:itervar", str) - if checkdepdency(): + if checkdependency(): verify() @@ -129,18 +129,18 @@ def verify(): # and compute findany( r"Stage_1.*A\.shared
Scope: shared.+>0.+>" - r"ax0\(kDataPar\).+>1.+ax1\(kDataPar\).+>2.+>ax2\(kDataPar\).+>" - r"\[A\(ax0, ax1, ax2\)\]", + r"ax0.*\(kDataPar\).+>1.+ax1.*\(kDataPar\).+>2.+>ax2.*\(kDataPar\).+>" + r"\[A[\[\(]ax0, ax1, ax2[\)\]]\]", str, ) # Check itervars of types different from KDataPar - findany(r"bk\(kVectorized\)", str) - findany(r"r.outer\(kCommReduce\)", str) + findany(r"bk.*\(kVectorized\)", str) + findany(r"r.outer.*\(kCommReduce\)", str) findany(r"label=ROOT", str) # Check the compute_at edge findany(r"Stage_1.*\[color\=\"\#000000\"\]", str) - if checkdepdency(): + if checkdependency(): verify()