Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoScheduler] Fix the type inference for conv3d #7475

Merged
merged 1 commit into from
Feb 19, 2021
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
14 changes: 13 additions & 1 deletion src/relay/op/nn/convolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef TVM_RELAY_OP_NN_CONVOLUTION_H_
#define TVM_RELAY_OP_NN_CONVOLUTION_H_

#include <tvm/auto_scheduler/compute_dag.h>
#include <tvm/support/logging.h>
#include <tvm/tir/analysis.h>

Expand Down Expand Up @@ -369,7 +370,18 @@ bool Conv3DRel(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 "DHWIO"
ICHECK_EQ(param->kernel_layout, "DHWIO");
wshape = auto_scheduler::GetShapeFromRewrittenLayout(param->auto_scheduler_rewritten_layout,
{"rd", "rh", "rw", "rc", "cc"});
}

wshape = trans_kernel_layout.ForwardShape(wshape);
if (param->kernel_size.defined()) {
ICHECK_EQ(param->kernel_size.size(), 3);
// check the size
Expand Down