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

Method exec

dnn/src/fallback/mask_conv/opr_impl.cpp:159–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void MaskConvForwardImpl::exec(
160 _megdnn_tensor_in src, _megdnn_tensor_in filter, _megdnn_tensor_in mask,
161 _megdnn_tensor_out dst, _megdnn_workspace workspace) {
162 check_exec(src.layout, filter.layout, mask.layout, dst.layout, workspace.size);
163 size_t N = src.layout[0], OC = filter.layout[0], IC = filter.layout[1],
164 IH = src.layout[2], IW = src.layout[3], OH = dst.layout[2],
165 OW = dst.layout[3], PH = param().pad_h, PW = param().pad_w,
166 SH = param().stride_h, SW = param().stride_w, FH = filter.layout[2],
167 FW = filter.layout[3], DH = param().dilate_h, DW = param().dilate_w;
168 bool is_xcorr = param().mode != Mode::CONVOLUTION;
169 auto wbundle = get_wbundle(OC, OH, OW, IC, IH, IW, FH, FW, PH, PW);
170 wbundle.set(workspace.ptr<void>());
171 if (filter.layout.dtype == dtype::Float32()) {
172#define cb(DType) \
173 if (mask.layout.dtype == DType()) { \
174 using ctype = typename DTypeTrait<DType>::ctype; \
175 MEGDNN_DISPATCH_CPU_KERN( \
176 static_cast<HandleImpl*>(handle()), \
177 exec_internel<ctype>( \
178 src.ptr<float>(), filter.ptr<float>(), mask.ptr<ctype>(), \
179 dst.ptr<float>(), wbundle, m_matmul_opr.get(), N, IC, OC, IH, \
180 IW, OH, OW, PH, PW, SH, SW, FH, FW, DH, DW, is_xcorr);); \
181 return; \
182 }
183 MEGDNN_FOREACH_COMPUTING_DTYPE_INT(cb)
184 }
185 megdnn_assert(0);
186}
187
188size_t MaskConvForwardImpl::get_workspace_in_bytes(
189 const TensorLayout& src, const TensorLayout& filter, const TensorLayout& mask,

Callers 1

repFunction · 0.45

Calls 3

paramFunction · 0.50
get_wbundleFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected