Skip to content

Instantly share code, notes, and snippets.

@andreaschandra
Created March 6, 2022 03:49
Show Gist options
  • Save andreaschandra/b6553e03808bf888afe4a746a4c23c9d to your computer and use it in GitHub Desktop.
Save andreaschandra/b6553e03808bf888afe4a746a4c23c9d to your computer and use it in GitHub Desktop.
def conv3x3(
in_planes: int, out_planes: int, stride: int = 1, groups: int = 1, dilation: int = 1
) -> nn.Conv2d:
"""3x3 convolution with padding"""
return nn.Conv2d(
in_planes,
out_planes,
kernel_size=3,
stride=stride,
padding=dilation,
groups=groups,
bias=False,
dilation=dilation,
)
def conv1x1(in_planes: int, out_planes: int, stride: int = 1) -> nn.Conv2d:
"""1x1 convolution"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment