|
1 | | -# Copyright 2020 The TensorFlow Authors. All Rights Reserved. |
| 1 | +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. |
2 | 2 | # |
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 4 | # you may not use this file except in compliance with the License. |
|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | | -# ============================================================================== |
| 14 | + |
| 15 | +# Orginal implementation from keras_contrib/layer/normalization |
| 16 | +# ============================================================================= |
15 | 17 |
|
16 | 18 | import tensorflow as tf |
17 | 19 | from tensorflow.keras import ( |
|
26 | 28 |
|
27 | 29 | @tf.keras.utils.register_keras_serializable(package="Addons") |
28 | 30 | class NoisyDense(tf.keras.layers.Layer): |
29 | | - """Like normal dense layer (https://github.com/tensorflow/tensorflow/blob/v2.3.0/tensorflow/python/keras/layers/core.py#L1067-L1233) |
30 | | - but random noisy is added to the weights matrix. But as the network improves the random noise is decayed until it is insignificant. |
| 31 | + """Like normal dense layer but random noisy is added to the weights matrix. But |
| 32 | + as the network improves the random noise is decayed until it is insignificant. |
31 | 33 |
|
32 | 34 | A `NoisyDense` layer implements the operation: |
33 | 35 | `output = activation(dot(input, µ_kernel + (σ_kernel * ε_kernel)) + bias)` |
@@ -237,6 +239,7 @@ def get_config(self): |
237 | 239 | { |
238 | 240 | "units": self.units, |
239 | 241 | "activation": activations.serialize(self.activation), |
| 242 | + "use_bias": self.use_bias, |
240 | 243 | "kernel_regularizer": regularizers.serialize(self.kernel_regularizer), |
241 | 244 | "bias_regularizer": regularizers.serialize(self.bias_regularizer), |
242 | 245 | "activity_regularizer": regularizers.serialize( |
|
0 commit comments