| 303 | } |
| 304 | |
| 305 | void 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 | |
| 327 | void Elemwise::get_output_var_shape( |
| 328 | const TensorShapeArray& inp_shape, TensorShapeArray& out_shape) const { |
nothing calls this directly
no test coverage detected