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)
| 92 | |
| 93 | |
| 94 | def 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 | |
| 103 | class Conv2dDynamicSamePadding(nn.Conv2d): |
no outgoing calls
no test coverage detected