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 2022/12/16 09:38:15 UTC

[GitHub] [tvm] leandron commented on a diff in pull request #13632: [TVMC] Add convert_layout of nn.upsampling

leandron commented on code in PR #13632:
URL: https://github.com/apache/tvm/pull/13632#discussion_r1050542801


##########
python/tvm/relay/op/nn/_nn.py:
##########
@@ -47,6 +47,42 @@
 # log_softmax
 reg.register_strategy("nn.log_softmax", strategy.log_softmax_strategy)
 
+# upsampling_tanspose

Review Comment:
   ```suggestion
   # upsampling_transpose
   ```



##########
python/tvm/relay/op/nn/_nn.py:
##########
@@ -47,6 +47,42 @@
 # log_softmax
 reg.register_strategy("nn.log_softmax", strategy.log_softmax_strategy)
 
+# upsampling_tanspose
+@reg.register_convert_op_layout("nn.upsampling")
+def convert_upsampling(attrs, inputs, tinfos, desired_layouts):
+    """Convert Layout pass registration for upsampling op.
+
+    Parameters
+    ----------
+    attrs : tvm.ir.Attrs
+        Attributes of current convolution
+    inputs : list of tvm.relay.Expr
+        The args of the Relay expr to be legalized
+    tinfos : list of types
+        List of input and output types
+    desired_layouts : list of layout strings
+        List of layouts defining our desired
+        layout for the data and kernel inputs respectively.
+
+    Returns
+    -------
+    result : tvm.relay.Expr
+        The transformed expr
+    """
+    data = inputs[0]
+    new_attrs = dict(attrs)
+    assert len(desired_layouts) == 1, "A desired layout is expected for upsampling's inputs"

Review Comment:
   ```suggestion
       assert len(desired_layouts) == 1, "A desired layout is expected for upsampling inputs"
   ```



-- 
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: commits-unsubscribe@tvm.apache.org

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