Skip to content

Instantly share code, notes, and snippets.

@McSpooder
Last active July 22, 2020 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McSpooder/23c52c80888a269a01dc36d749d724b6 to your computer and use it in GitHub Desktop.
Save McSpooder/23c52c80888a269a01dc36d749d724b6 to your computer and use it in GitHub Desktop.
Neural Network Blocks - ConvBlock
class ConvBlock(nn.Module):
def __init__(self, c_in, c_out, ks, k_stride=1):
super().__init__()
self.conv1 = nn.Conv3d(c_in, c_out, ks, stride=k_stride, padding=(1,1,1))
self.bn = nn.BatchNorm3d(c_out)
self.elu = nn.ELU()
self.pool = nn.MaxPool3d(kernel_size=(3,3,3), stride=2)
self.dropout = nn.Dropout3d(p=0.1)
def forward(self, x):
out = self.conv1(x)
out = self.bn(out)
out = self.elu(out)
out = self.pool(out)
out = self.dropout(out)
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment