MCPcopy Create free account
hub / github.com/lukemelas/EfficientNet-PyTorch / get_same_padding_conv2d

Function get_same_padding_conv2d

efficientnet_pytorch/utils.py:94–100  ·  view source on GitHub ↗

Chooses static padding if you have specified an image size, and dynamic padding otherwise. Static padding is necessary for ONNX exporting of models.

(image_size=None)

Source from the content-addressed store, hash-verified

92
93
94def get_same_padding_conv2d(image_size=None):
95 """ Chooses static padding if you have specified an image size, and dynamic padding otherwise.
96 Static padding is necessary for ONNX exporting of models. """
97 if image_size is None:
98 return Conv2dDynamicSamePadding
99 else:
100 return partial(Conv2dStaticSamePadding, image_size=image_size)
101
102
103class Conv2dDynamicSamePadding(nn.Conv2d):

Callers 3

__init__Method · 0.85
__init__Method · 0.85
from_pretrainedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected