Skip to content
Snippets Groups Projects
Commit 0996be3b authored by Dennis Noll's avatar Dennis Noll
Browse files

[keras] adds improvements for DenseLayer

parent 52859642
No related branches found
No related tags found
No related merge requests found
......@@ -975,13 +975,20 @@ class DenseLayer(tf.keras.layers.Layer):
def build(self, input_shape):
parts = []
if self.activation == "selu":
kernel_initializer = tf.variance_scaling_initializer(factor=1.0, mode="FAN_IN")
else:
kernel_initializer = "glorot_uniform"
l2 = tf.keras.regularizers.l2(self.l2)
weights = tf.keras.layers.Dense(self.nodes, kernel_regularizer=l2)
weights = tf.keras.layers.Dense(
self.nodes,
kernel_regularizer=l2,
kernel_initializer=kernel_initializer,
)
parts.append(weights)
if self.batch_norm:
self.dropout = 0.0
if self.batch_norm and not self.activation == "selu":
bn = tf.keras.layers.BatchNormalization()
parts.append(bn)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment