Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/tvm/topi/nn/conv2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def conv2d_nhwc(
"NHWC",
out_dtype,
auto_scheduler_rewritten_layout,
auto_scheduler_should_rewrite_layout=True,
)


Expand Down Expand Up @@ -714,6 +715,7 @@ def conv(
order: str,
out_dtype: Union[str, None] = None,
auto_scheduler_rewritten_layout: Optional[str] = None,
auto_scheduler_should_rewrite_layout: bool = False,
):
"""Convolution operator in NCHW or NHWC layout.

Expand Down Expand Up @@ -752,6 +754,11 @@ def conv(
Elements are converted to this type before elementwise multiplication
and summation.

auto_scheduler_should_rewrite_layout : bool
Should auto scheduler be allowed to rewrite the layout of the filter
tensor. Defaults to false. This can cause errors if used with grouped
convs.

auto_scheduler_rewritten_layout: str
Layout from autoscheduler's layout rewritting.

Expand Down Expand Up @@ -862,7 +869,7 @@ def compute(*args):
# tag is expected to be lowercase
tag=f"{'group_' if groups > 1 else ''}conv{dim}d_{order.lower()}",
name=f"{'group_' if groups > 1 else ''}conv{dim}d_{order.lower()}",
attrs={"layout_free_placeholders": [filt]},
attrs={"layout_free_placeholders": [filt]} if auto_scheduler_should_rewrite_layout else {},
varargs_names=list(np.array(["nn", "ff", "yy", "xx", "zz"])[permutation_from]),
)
# if we used autoscheduler's changed layout we need to rewrite the ordering
Expand Down