Use ReLU with normalization

This commit is contained in:
Mattéo Delabre 2019-12-15 00:03:20 -05:00
parent 197a01e993
commit 6d31ab3a13
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 4 additions and 3 deletions

View File

@ -36,12 +36,13 @@ class ConstellationNet(nn.Module):
for layer_size in encoder_layers_sizes: for layer_size in encoder_layers_sizes:
encoder_layers.append(nn.Linear(prev_layer_size, layer_size)) encoder_layers.append(nn.Linear(prev_layer_size, layer_size))
encoder_layers.append(nn.Tanh()) encoder_layers.append(nn.ReLU())
prev_layer_size = layer_size prev_layer_size = layer_size
encoder_layers += [ encoder_layers += [
nn.Linear(prev_layer_size, 2), nn.Linear(prev_layer_size, 2),
nn.Tanh(), nn.ReLU(),
nn.BatchNorm1d(2),
] ]
self.encoder = nn.Sequential(*encoder_layers) self.encoder = nn.Sequential(*encoder_layers)
@ -56,7 +57,7 @@ class ConstellationNet(nn.Module):
for layer_size in decoder_layers_sizes: for layer_size in decoder_layers_sizes:
decoder_layers.append(nn.Linear(prev_layer_size, layer_size)) decoder_layers.append(nn.Linear(prev_layer_size, layer_size))
decoder_layers.append(nn.Tanh()) decoder_layers.append(nn.ReLU())
prev_layer_size = layer_size prev_layer_size = layer_size
# Softmax is not used at the end of the network because the # Softmax is not used at the end of the network because the