Skip to content

Commit

Permalink
[AutoScheduler] Fix the type inference for conv2d (#7501)
Browse files Browse the repository at this point in the history
* fix type inference for conv2d

* fix
  • Loading branch information
tmoreau89 authored Feb 24, 2021
1 parent d425c14 commit 086dbfe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/relay/op/nn/convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,18 @@ bool Conv2DRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
} else {
// use weight to infer the conv shape.
if (weight == nullptr) return false;
auto wshape = trans_kernel_layout.ForwardShape(weight->shape);

Array<PrimExpr> wshape;
if (param->auto_scheduler_rewritten_layout.size() == 0) {
wshape = weight->shape;
} else {
// works for the default kernel layout "HWIO"
ICHECK_EQ(param->kernel_layout, "HWIO");
wshape = auto_scheduler::GetShapeFromRewrittenLayout(param->auto_scheduler_rewritten_layout,
{"ry", "rx", "rc", "ff"});
}

wshape = trans_kernel_layout.ForwardShape(wshape);
if (param->kernel_size.defined()) {
ICHECK_EQ(param->kernel_size.size(), 2);

Expand Down

0 comments on commit 086dbfe

Please sign in to comment.