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

Function fuse_mul_add4

dnn/src/naive/elemwise/opr_impl.cpp:30–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29template <typename ctype>
30void fuse_mul_add4(ctype* dest, const ElemwiseOpParamN<4>& param) {
31 auto iter0 = tensor_iter_valonly<ctype>(param[0]).begin();
32 auto iter1 = tensor_iter_valonly<ctype>(param[1]).begin();
33 auto p2 = param[2].ptr<ctype>(), p3 = param[3].ptr<ctype>();
34
35 for (size_t i = 0; i < param.size; ++i) {
36 auto off0 = iter0.offset(), off1 = iter1.offset();
37 dest[i] = (*iter0) * (*iter1) + p2[off0] * p3[off1];
38 ++iter0;
39 ++iter1;
40 }
41}
42
43} // anonymous namespace
44

Callers 1

impl_fuse_mul_add4Method · 0.85

Calls 2

beginMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected