Set broadcast flag for binary operators
Summary:
lines such as
output_scores = best_scores_per_hypo + scores_t_squeezed
hypo_t_int64 = best_indices / 6LL
will emit the respective binary operator (e.g. `Add`, `Div`) with the `broadcast` flag set to 1
Closes https://github.com/caffe2/caffe2/pull/1577
Reviewed By: zdevito
Differential Revision: D6489991
Pulled By: jamesr66a
fbshipit-source-id: 3bef2bd43dfa18659a299cc62affd74f9a763491
diff --git a/caffe2/contrib/script/compiler.cc b/caffe2/contrib/script/compiler.cc
index 45ff385..a8e57b0 100644
--- a/caffe2/contrib/script/compiler.cc
+++ b/caffe2/contrib/script/compiler.cc
@@ -204,6 +204,9 @@
op->add_input(v);
}
op->add_output(fresh());
+ auto broadcast = op->add_arg();
+ broadcast->set_name("broadcast");
+ broadcast->set_i(1);
return op;
}
case TK_APPLY: {