Skip to content

Commit

Permalink
Check that alteroplayout is definedbefore using it
Browse files Browse the repository at this point in the history
  • Loading branch information
tkonolige committed Sep 29, 2020
1 parent 69fe439 commit 74cf118
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/relay/transforms/transform_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,10 @@ Expr LayoutRewriter(const Call& ref_call, const Array<Expr>& new_args, const Obj

// If there is no FInferCorrectLayout for the type, then we just assume the layout is correct.
static auto finfer_layout = Op::GetAttrMap<FInferCorrectLayout>("FInferCorrectLayout");
static auto falter_layout = Op::GetAttrMap<FTVMAlterOpLayout>("FTVMAlterOpLayout");
if (ref_call->op.as<OpNode>()) {
Op op = Downcast<Op>(ref_call->op);
if (!finfer_layout.count(op)) {
if (falter_layout.count(op) && !finfer_layout.count(op)) {
return memorizer.CallWithNewLayouts(ref_call, normal_new_args);
}
}
Expand Down

0 comments on commit 74cf118

Please sign in to comment.