Skip to content

Commit fa54c00

Browse files
authored
add use bias to config
1 parent 840ab1c commit fa54c00

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tensorflow_addons/layers/noisy_dense.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
1+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -11,7 +11,9 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
# ==============================================================================
14+
15+
# Orginal implementation from keras_contrib/layer/normalization
16+
# =============================================================================
1517

1618
import tensorflow as tf
1719
from tensorflow.keras import (
@@ -26,8 +28,8 @@
2628

2729
@tf.keras.utils.register_keras_serializable(package="Addons")
2830
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.
3133
3234
A `NoisyDense` layer implements the operation:
3335
`output = activation(dot(input, µ_kernel + (σ_kernel * ε_kernel)) + bias)`
@@ -237,6 +239,7 @@ def get_config(self):
237239
{
238240
"units": self.units,
239241
"activation": activations.serialize(self.activation),
242+
"use_bias": self.use_bias,
240243
"kernel_regularizer": regularizers.serialize(self.kernel_regularizer),
241244
"bias_regularizer": regularizers.serialize(self.bias_regularizer),
242245
"activity_regularizer": regularizers.serialize(

0 commit comments

Comments
 (0)