Skip to content

Commit

Permalink
move comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hypercubestart committed Jan 20, 2021
1 parent e2baa41 commit 1e7fdc5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/language/from_relay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ fn compile_expression(
.clone()
.downcast::<tvm::ir::relay::Call>()
{
// For batch norms, we use a hack where if
// simplify_batch_norm_for_inference_hack is set,
// we compile the Relay batch norm to a single output.

// All other expressions are compiled using Language::TupleGetItem construct

if simplify_batch_norm_for_inference_hack
&& call
.op
Expand All @@ -689,18 +695,13 @@ fn compile_expression(
== "nn.batch_norm"
&& tuple_get_item.index == 0
{
// For batch norms, we use a hack where if
// simplify_batch_norm_for_inference_hack is set,
// we compile the Relay batch norm to a single output.
get_compiled_expression(tuple_get_item.tuple.clone())
} else {
// All other expressions are compiled using Language::TupleGetItem construct
let data_id = get_compiled_expression(tuple_get_item.tuple.clone());
let index_id = glenside_expr.add(Language::Usize(tuple_get_item.index as usize));
glenside_expr.add(Language::TupleGetItem([data_id, index_id]))
}
} else {
// All other expressions are compiled using Language::TupleGetItem construct
let data_id = get_compiled_expression(tuple_get_item.tuple.clone());
let index_id = glenside_expr.add(Language::Usize(tuple_get_item.index as usize));
glenside_expr.add(Language::TupleGetItem([data_id, index_id]))
Expand Down

0 comments on commit 1e7fdc5

Please sign in to comment.