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

Function TEST

src/plugin/test/opr_footprint.cpp:124–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122} // namespace
123
124TEST(TestOprFootprint, Elemwise) {
125 using Param = opr::Elemwise::Param;
126 auto test_elemwise_group = [](Param::Mode mode, size_t nr_inputs, size_t k) {
127 auto func = [&nr_inputs](
128 SymbolVar x, SymbolVar y, SymbolVar z,
129 const Param& param = {}) {
130 SymbolVarArray inputs{x, y, z};
131 inputs.resize(nr_inputs);
132 return opr::Elemwise::make(inputs, param);
133 };
134 Param param;
135 param.mode = mode;
136 run_test(
137 func, {2, 3, 3}, {2, 3, 3}, {2, 3, 3}, 18 * k, 18 * (nr_inputs + 1),
138 dtype::Float32(), param);
139 auto mem = 30 * (nr_inputs + 1);
140 if (nr_inputs == 3)
141 mem -= 2 * 3 * 4;
142 run_test(
143 func, {2, 5, 3}, {2, 5, 3}, {2, 1, 3}, 30 * k, mem, dtype::Int32(),
144 param);
145 };
146 test_elemwise_group(Param::Mode::SIGMOID, 1, 1);
147 test_elemwise_group(Param::Mode::ADD, 2, 1);
148 test_elemwise_group(Param::Mode::FUSE_MUL_ADD3, 3, 2);
149}
150
151TEST(TestOprFootprint, AddUpdate) {
152 using Param = opr::AddUpdate::Param;

Callers

nothing calls this directly

Calls 9

make_no_value_inferFunction · 0.85
compile_and_runFunction · 0.85
resizeMethod · 0.80
run_testFunction · 0.70
makeFunction · 0.50
ParamClass · 0.50
loadFunction · 0.50
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected