Skip to content

Instantly share code, notes, and snippets.

@AlessandroMondin
Last active July 20, 2022 12:56
Show Gist options
  • Save AlessandroMondin/8cbc49ce59ed523fee19a5cb0932d1e6 to your computer and use it in GitHub Desktop.
Save AlessandroMondin/8cbc49ce59ed523fee19a5cb0932d1e6 to your computer and use it in GitHub Desktop.
class CNNBlock(nn.Module):
def __init__(self,
in_channels,
out_channels,
kernel_size=3,
stride=1,
padding=0):
super(CNNBlock, self).__init__()
self.seq_block = nn.Sequential(
nn.Conv2d(in_channels, out_channels, kernel_size, stride, padding, bias=False),
nn.BatchNorm2d(out_channels),
nn.ReLU(inplace=True)
)
def forward(self, x):
x = self.seq_block(x)
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment