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

Method flip_filter

dnn/src/cuda/convolution/helper.cpp:59–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void convolution::flip_filter(
60 const ForwardSizeArgs& args, const Workspace& workspace, RefPtr& ref_ptr) {
61 auto&& fm = args.filter_meta;
62 megdnn_assert(fm.group == 1 && fm.spatial_ndim == 2);
63 auto OC = fm.ocpg, IC = fm.icpg, FH = fm.spatial[0], FW = fm.spatial[1];
64 auto dtype = fm.dtype;
65 megdnn_assert(workspace.size >= dtype.size() * OC * IC * FH * FW);
66
67 TensorND src{{{OC, IC, FH, FW}, dtype}, ref_ptr},
68 dst{workspace.raw_ptr + (FH * FW - 1) * dtype.size(), src.layout};
69 dst.layout.stride[2] = -dst.layout.stride[2];
70 dst.layout.stride[3] = -dst.layout.stride[3];
71 args.handle->relayout_opr()->exec(src, dst);
72 ref_ptr.reset(workspace.raw_ptr);
73}
74
75// vim: syntax=cpp.doxygen

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.45
execMethod · 0.45
relayout_oprMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected