MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / LocalShareForward>

Method LocalShareForward>

src/plugin/impl/opr_footprint.cpp:302–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301template <>
302uint64_t opr_footprint_func<opr::LocalShareForward>(cg::OperatorNodeBase* opr) {
303 mgb_assert(opr->input().size() == 2, "LocalShare opr should have two inputs");
304 auto&& out_shape = opr->output()[0]->shape();
305 auto&& src_shape = opr->input()[0]->shape();
306 auto&& filter_shape = opr->input()[1]->shape();
307 using Param = opr::LocalShareForward::Param;
308 auto&& param = opr->cast_final_safe<opr::LocalShareForward>().param();
309 mgb_assert(param.format == Param::Format::NCHW);
310 size_t groups = 1;
311 size_t kern_spatial_pos = 3;
312 if (param.sparse == Param::Sparse::GROUP) {
313 groups = filter_shape[0];
314 kern_spatial_pos = 4;
315 }
316 size_t fh = filter_shape[kern_spatial_pos], fw = filter_shape[kern_spatial_pos + 1];
317 return out_shape.total_nr_elems() * fh * fw * src_shape[1] * 2 / groups;
318}
319
320template <>
321uint64_t opr_footprint_func<opr::LocalShareBackwardData>(cg::OperatorNodeBase* opr) {

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.45
inputMethod · 0.45
shapeMethod · 0.45
outputMethod · 0.45
paramMethod · 0.45
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected