Overhead of weight variable creation during inference
Created by: hshen14
In current implementation, each iteration for inference will re-create weight variables. I ran the CAPI on ResNet-50 with BS=1 and found the overhead of variable creation is 2% (most are malloc).
Could you please explain whether it is a known issue or there are some usage issues at my side? Thanks. @luotao1 @Superjomn @panyx0718
Variable* Scope::VarInternal(const std::string& name) { auto* v = FindVarLocally(name); if (v != nullptr) return v;
v = new Variable(); vars_[name].reset(v); VLOG(30) << "Create variable " << name; v->name_ = &(vars_.find(name)->first); return v; }