提交 968f74ce 编写于 作者: M Megvii Engine Team

chore(mgb): add no_force_inplace option to ComputingGraph

GitOrigin-RevId: 350c90fb8613217b2fbc07134b3a65c3341efd94
上级 e1fba6ec
......@@ -376,6 +376,7 @@ public:
ProxyGraphImpl(ProxyGraph* owner) : m_owner(owner) {
options().imperative_proxy_graph = true;
options().no_force_inplace = true;
options().log_level = 0;
m_var_receiver_info.dev_value = 1;
m_var_receiver_info.allow_empty_value = 1;
......
......@@ -464,6 +464,17 @@ class ComputingGraph : public std::enable_shared_from_this<ComputingGraph>,
bool imperative_proxy_graph = false;
/*!
* Request that operators should not force update their inputs.
*
* THIS FLAG IS RESERVED FOR INTERNAL USE
*
* When this flag is set, operators like AddUpdate and BatchNorm
* will still attempt to inplace update their inputs, but failing
* to do so will not be considered as an error.
*/
bool no_force_inplace = false;
//! add extra deps for the comp seq if a specific var is dependent
ThinHashMap<VarNode*, VarNodeArray> extra_vardeps;
......
......@@ -40,7 +40,7 @@ BatchNormForward::BatchNormForward(VarNode *x,
Super{x->owner_graph(), config, "batch_norm",
{x, scale, bias, mean, variance}}
{
if(owner_graph()->options().imperative_proxy_graph) {
if(owner_graph()->options().no_force_inplace) {
m_force_inplace = false;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册