echuraev commented on code in PR #16199:
URL: https://github.com/apache/tvm/pull/16199#discussion_r1418470232


##########
tests/python/frontend/pytorch/test_forward.py:
##########
@@ -720,9 +720,27 @@ def forward(self, *args):
             c = (args[0][:, :, 2] + 5) * 13
             return torch.cat([t.unsqueeze(2) for t in [a, b, c]], 2)
 
+    class Concatenate3(Module):
+        # pylint: disable=missing-class-docstring
+        def __init__(self):
+            super().__init__()
+
+            class _Concatenate(Module):
+                def forward(self, *args):
+                    a = (args[0][:, :, 0] + 2) * 7
+                    b = (args[0][:, :, 1] + 3) * 11
+                    c = (args[0][:, :, 2] + 5) * 13
+                    return torch.concat([t.unsqueeze(2) for t in [a, b, c]], 2)
+
+            self.mod = _Concatenate()
+
+        def forward(self, *args):
+            return self.mod(*args)
+

Review Comment:
   Why do you create a class in this way?
   Will the following code work in the same way?
   ```suggestion
       class Concatenate3(Module):
           def forward(self, *args):
               a = (args[0][:, :, 0] + 2) * 7
               b = (args[0][:, :, 1] + 3) * 11
               c = (args[0][:, :, 2] + 5) * 13
               return torch.concat([t.unsqueeze(2) for t in [a, b, c]], 2)
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to