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

Method calc_conv

imperative/python/megengine/module/conv.py:227–255  ·  view source on GitHub ↗
(self, inp, weight, bias)

Source from the content-addressed store, hash-verified

225 return ((0, 0), (0, 0), (self.padding, self.padding))
226
227 def calc_conv(self, inp, weight, bias):
228 assert self.padding_mode in [
229 "zeros",
230 "reflect",
231 "replicate",
232 ]
233 if self.padding_mode != "zeros":
234 return conv1d(
235 pad(inp, self.get_pad_witdth(), self.padding_mode),
236 weight,
237 bias,
238 self.stride,
239 0,
240 self.dilation,
241 self.groups,
242 self.conv_mode,
243 self.compute_mode,
244 )
245 return conv1d(
246 inp,
247 weight,
248 bias,
249 self.stride,
250 self.padding,
251 self.dilation,
252 self.groups,
253 self.conv_mode,
254 self.compute_mode,
255 )
256
257 def forward(self, inp):
258 return self.calc_conv(inp, self.weight, self.bias)

Callers 4

forwardMethod · 0.95
forwardMethod · 0.45
calc_conv_bn_qatMethod · 0.45
forwardMethod · 0.45

Calls 3

get_pad_witdthMethod · 0.95
conv1dFunction · 0.85
padFunction · 0.50

Tested by 1

forwardMethod · 0.36