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

Method add_deconv

src/gopt/test/network.cpp:82–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82SymbolVar Network::add_deconv(
83 SymbolVar f, size_t ratio, size_t output_channels, DType out_dtype) {
84 static int weight_idx = 0;
85 size_t kernel = ratio * 2 - ratio % 2;
86 size_t pad = ratio / 2;
87
88 size_t input_channels = f.node()->shape()[1];
89 auto weight = add_cvar(
90 ssprintf("w%d", weight_idx).c_str(),
91 {input_channels, output_channels, kernel, kernel});
92
93 if (out_dtype.category() == DTypeCategory::QUANTIZED) {
94 weight = add_type_cvt(weight, out_dtype);
95 }
96 opr::ConvolutionBackwardData::Param param;
97 param.stride_h = param.stride_w = ratio;
98 param.pad_h = param.pad_w = pad;
99
100 auto deconv = opr::ConvolutionBackwardData::make(
101 weight, f, param, {}, OperatorNodeConfig{out_dtype});
102 weight_idx++;
103 return deconv;
104}
105
106SymbolVar Network::add_elemwise(
107 const SymbolVarArray inps, DType out_dtype, opr::Elemwise::Param::Mode mode) {

Callers 1

fusion_pyramids_featureFunction · 0.80

Calls 4

categoryMethod · 0.80
makeFunction · 0.50
shapeMethod · 0.45
nodeMethod · 0.45

Tested by

no test coverage detected