Created
November 23, 2020 05:33
-
-
Save panchishin/1c92b3a2ed4213d99cb81b8c47c36073 to your computer and use it in GitHub Desktop.
Dense ResNet Like Layer
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 DenseResNet(tf.keras.layers.Layer): | |
def __init__(self, units=500, activation="tanh", kernel_initializer="glorot_uniform", layers=2): | |
super(DenseResNet, self).__init__() | |
self.layers = [tf.keras.layers.Dense(units, activation=activation, kernel_initializer=kernel_initializer) for _ in range(layers)] | |
def call(self, inputs): | |
result = inputs | |
for layer in self.layers: | |
result = layer(result) | |
return tf.keras.layers.Add()([inputs,result]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment