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

Method calc_conv

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

Source from the content-addressed store, hash-verified

412 )
413
414 def calc_conv(self, inp, weight, bias):
415 assert self.padding_mode in [
416 "zeros",
417 "reflect",
418 "replicate",
419 ]
420 if self.padding_mode != "zeros":
421 return conv2d(
422 pad(inp, self.get_pad_witdth(), self.padding_mode),
423 weight,
424 bias,
425 self.stride,
426 0,
427 self.dilation,
428 self.groups,
429 self.conv_mode,
430 self.compute_mode,
431 )
432 return conv2d(
433 inp,
434 weight,
435 bias,
436 self.stride,
437 self.padding,
438 self.dilation,
439 self.groups,
440 self.conv_mode,
441 self.compute_mode,
442 )
443
444 def forward(self, inp):
445 return self.calc_conv(inp, self.weight, self.bias)

Callers 2

forwardMethod · 0.95
calc_conv_qatMethod · 0.95

Calls 3

get_pad_witdthMethod · 0.95
conv2dFunction · 0.50
padFunction · 0.50

Tested by

no test coverage detected