MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / init_output_static_infer_desc

Method init_output_static_infer_desc

src/opr/impl/basic_arith.cpp:305–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void Elemwise::init_output_static_infer_desc() {
306 Super::init_output_static_infer_desc();
307 static StaticInferOpr<megdnn::Elemwise> static_infer_opr;
308
309 using namespace cg::static_infer;
310
311 auto infer_value = [this](DeviceTensorND& dest, const InpVal& inp) {
312 SmallVector<DeviceTensorND> inp_vals(inp.val.size());
313 for (size_t i = 0; i < inp_vals.size(); ++i)
314 inp_vals[i] = inp.val[i].value();
315 auto sopr = static_infer_opr.lock();
316 perform(param().mode, dest, inp_vals, sopr());
317 return true;
318 };
319
320 DepVal deps(input().size());
321 for (size_t i = 0; i < input().size(); ++i)
322 deps[i] = {input(i), DepType::VALUE};
323 owner_graph()->static_infer_manager().register_value_infer(
324 output(0), {SourceType::DEP, deps, infer_value});
325}
326
327void Elemwise::get_output_var_shape(
328 const TensorShapeArray& inp_shape, TensorShapeArray& out_shape) const {

Callers

nothing calls this directly

Calls 15

workspace_sizeMethod · 0.80
as_megdnnMethod · 0.80
resizeMethod · 0.80
paramFunction · 0.50
sizeMethod · 0.45
valueMethod · 0.45
lockMethod · 0.45
register_value_inferMethod · 0.45
dtypeMethod · 0.45
atMethod · 0.45
register_shape_inferMethod · 0.45

Tested by

no test coverage detected