lhutton1 commented on code in PR #14272:
URL: https://github.com/apache/tvm/pull/14272#discussion_r1135821786
##########
python/tvm/driver/tvmc/transform.py:
##########
@@ -210,9 +229,8 @@ def generate_transform_args(parser):
# AlterLayout
parser.add_argument(
"--desired-layout",
- choices=["NCHW", "NHWC"],
- default=None,
- help="Change the data layout of the whole graph.",
+ nargs="+",
+ help="Change the data/kernel layout of the graph. (i.e. NCHW or
NHWC:HWIO)",
Review Comment:
Would be good to also show an example of a list of layouts when
`--desired-layout-ops` is provided
##########
python/tvm/driver/tvmc/transform.py:
##########
@@ -123,7 +125,24 @@ def convert_graph_layout(mod, desired_layout, ops=None):
if ops is None:
ops = ["nn.conv2d", "nn.conv2d_transpose", "qnn.conv2d"]
- desired_layouts = {op: [desired_layout, "default"] for op in ops}
+ assert isinstance(desired_layouts, list) and len(desired_layouts) > 0
Review Comment:
Shall we still allow a single `str` input to keep backwards compatibility?
##########
tests/python/driver/tvmc/test_transform.py:
##########
@@ -72,6 +74,86 @@ def
test_layout_transform_convert_layout_pass_args(relay_conv2d, monkeypatch):
)
+def test_layout_transform_convert_kernel_layout_pass_args(relay_conv2d,
monkeypatch):
+ """
+ Check the convert layout desired layouts arugment is what is expected when
+ a non-default kernel layout is provided.
+ """
+ desired_layout = "NHWC:HWIO"
+ desired_layout_ops = ["nn.nonv2d"]
Review Comment:
"nn.conv2d"
--
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]