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

Method create_block

src/gopt/test/network.cpp:170–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170SymbolVar mgb::create_block(
171 Network& network, SymbolVar f_in, size_t stride, size_t num_outputs1,
172 bool has_proj, DType out_dtype) {
173 auto proj = f_in;
174 if (has_proj) {
175 proj = network.add_conv(
176 f_in, num_outputs1, {1, 1}, out_dtype, false, {stride, stride});
177 }
178
179 auto f = network.add_conv(
180 f_in, num_outputs1, {3, 3}, out_dtype, true, {stride, stride}, {1, 1});
181
182 f = network.add_conv(f, num_outputs1, {3, 3}, out_dtype, true, {1, 1}, {1, 1});
183
184 f = network.add_elemwise({f, proj}, out_dtype, opr::Elemwise::Mode::FUSE_ADD_RELU);
185 return f;
186}
187
188SymbolVar mgb::make_resnet18(Network& network, size_t batch, DType out_dtype) {
189 auto data = network.add_var("data", {batch, 4, 224, 224});

Callers

nothing calls this directly

Calls 2

add_convMethod · 0.80
add_elemwiseMethod · 0.80

Tested by

no test coverage detected