wweic commented on a change in pull request #5103: [Relay][ADT]Static Tensor 
Array
URL: https://github.com/apache/incubator-tvm/pull/5103#discussion_r400886793
 
 

 ##########
 File path: python/tvm/relay/prelude.py
 ##########
 @@ -27,6 +27,538 @@
 from . import op
 
 
+class StaticTensorArrayOps(object):
+    """Contains tensor array related ops for fixed rank tensor array"""
+
+    def __init__(self, prelude, dtype, shape):
+        """Create tensor array ops registry"""
+        self.prelude = prelude
+        self.dtype = dtype
+        self.shape = shape
+
+    def get_name(self, canonical):
+        """Get name corresponding to the canonical name"""
+        shape_str = str(self.shape).replace('[', '').replace(']', '')\
+            .replace('(', '').replace(')', '').replace(', ', '_')\
+            .replace(',', '')
+        if len(shape_str) == 0:
+            shape_str = "scalar"
+        if canonical == 'tensor_t':
+            return 'static_tensor_{}_{}_t'.format(self.dtype, shape_str)
+        return "{}_{}_{}".format(canonical, self.dtype, shape_str)
+
+    def get_var(self, canonical):
+        """Get var corresponding to the canonical name"""
+        name = self.get_name(canonical)
+        return getattr(self.prelude, name)
+
+    def define_tensor_adt(self):
+        """Defines the dynamic tensor ADT, which is the container for tensors
+        with variable shapes."""
 
 Review comment:
   ```suggestion
           """Defines the static tensor ADT, which is the container for tensors
           with fixed shape."""
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to