You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2020/06/15 17:20:26 UTC

[GitHub] [incubator-tvm] comaniac commented on a change in pull request #5811: [AutoTVM][Fix] Fixed 'not in list' error for define_reorder with 'candidate' policy.

comaniac commented on a change in pull request #5811:
URL: https://github.com/apache/incubator-tvm/pull/5811#discussion_r440313183



##########
File path: python/tvm/autotvm/task/space.py
##########
@@ -119,21 +125,26 @@ def __init__(self, var, name=None):
         super(VirtualAxis, self).__init__()
         self.num_output = 1
 
-        if name is None:
-            name = 'axis_%d' % VirtualAxis.name_ct
-            VirtualAxis.name_ct += 1
+        self.name = None
+        if name is not None:
+            self.name = name
 
-        self.name = name
         if isinstance(var, (int, _long)):
             self.length = var
+            if name is None:
+                self.name = 'axis_%d' % VirtualAxis.name_ct
+                VirtualAxis.name_ct += 1
         elif isinstance(var, schedule.IterVar):
-            self.name = var.var.name
+            if self.name is None:
+                self.name = var.var.name
             if var.dom is None:
                 self.length = -1
             else:
                 self.length = get_const_int(var.dom.extent)
         elif isinstance(var, VirtualAxis):
             self.length = var.length
+            if self.name is None:
+                self.name = var.name

Review comment:
       It seems doesn't match the original semantic?

##########
File path: python/tvm/autotvm/task/space.py
##########
@@ -119,21 +125,26 @@ def __init__(self, var, name=None):
         super(VirtualAxis, self).__init__()
         self.num_output = 1
 
-        if name is None:
-            name = 'axis_%d' % VirtualAxis.name_ct
-            VirtualAxis.name_ct += 1
+        self.name = None
+        if name is not None:
+            self.name = name

Review comment:
       You can just use `self.name = name` to cover 3 lines.

##########
File path: python/tvm/autotvm/task/space.py
##########
@@ -119,21 +125,26 @@ def __init__(self, var, name=None):
         super(VirtualAxis, self).__init__()
         self.num_output = 1
 
-        if name is None:
-            name = 'axis_%d' % VirtualAxis.name_ct
-            VirtualAxis.name_ct += 1
+        self.name = None
+        if name is not None:
+            self.name = name
 
-        self.name = name
         if isinstance(var, (int, _long)):
             self.length = var
+            if name is None:
+                self.name = 'axis_%d' % VirtualAxis.name_ct
+                VirtualAxis.name_ct += 1
         elif isinstance(var, schedule.IterVar):
-            self.name = var.var.name
+            if self.name is None:
+                self.name = var.var.name
             if var.dom is None:
                 self.length = -1
             else:
                 self.length = get_const_int(var.dom.extent)
         elif isinstance(var, VirtualAxis):

Review comment:
       Modify the class docstring (`var: int or tvm.te.schedule.IterVar`) to add `VirtualAxis`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org