Last active
July 22, 2020 13:26
-
-
Save McSpooder/23c52c80888a269a01dc36d749d724b6 to your computer and use it in GitHub Desktop.
Neural Network Blocks - ConvBlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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