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

Function gen_header

dnn/src/x86/script/gen_convolution2.py:151–173  ·  view source on GitHub ↗
(modes, simds, fsizes)

Source from the content-addressed store, hash-verified

149""".format(**vars()))
150
151def gen_header(modes, simds, fsizes):
152 with open('convolution_direct_special_cases.h', 'w') as f:
153 f.write("""#pragma once
154
155#include <cstddef>
156#include "megdnn/arch.h"
157
158namespace megdnn {
159namespace x86 {
160namespace detail {
161""")
162 for mode, simd, fsize in itertools.product(modes, simds, fsizes):
163 funcname = "convolution_{mode}_fh{fsize}_{simd}".format(**vars())
164 f.write("""
165void {funcname}(const float *src, const float *filter, float *dst,
166 const size_t src_h, const size_t src_w, const size_t dst_h, const size_t dst_w,
167 const size_t flt_w) MEGDNN_ATTRIBUTE_TARGET("{simd}");
168""".format(**vars()))
169
170 f.write("""} // namespace detail
171} // namespace x86
172} // namespace megdnn
173""")
174
175if __name__ == '__main__':
176 for mode in ['xcorr', 'conv']:

Callers 1

Calls 2

writeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected