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

Method exec

dnn/src/common/powc.cpp:8–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6using namespace megdnn;
7
8void PowC::exec(_megdnn_tensor_in src, _megdnn_tensor_out dst) {
9 megdnn_assert(
10 src.layout.dtype == dst.layout.dtype &&
11 src.layout.dtype.category() == DTypeCategory::FLOAT &&
12 src.layout.eq_shape(dst.layout),
13 "invalid layout: %s vs %s", src.layout.to_string().c_str(),
14 dst.layout.to_string().c_str());
15 int iv, *ivp = nullptr;
16 float fv, *fvp = nullptr;
17 float p = param().exp;
18 int pi = static_cast<int>(std::round(p));
19 if (std::abs(static_cast<float>(pi) - p) < std::numeric_limits<float>::epsilon()) {
20 iv = pi;
21 ivp = &iv;
22 } else {
23 fv = p;
24 fvp = &fv;
25 }
26 do_exec(src, dst, fvp, ivp);
27}
28
29// vim: syntax=cpp.doxygen

Callers 4

execFunction · 0.45
execFunction · 0.45
CompTypeCvterClass · 0.45

Calls 7

categoryMethod · 0.80
paramFunction · 0.50
roundFunction · 0.50
absFunction · 0.50
do_execFunction · 0.50
eq_shapeMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected