Skip to content

Commit a2ab533

Browse files
nkovela1edward-bot
authored andcommitted
Switches Keras object serialization to new logic and changes public API for deserialize_keras_object/serialize_keras_object to the new functions.
PiperOrigin-RevId: 480676373
1 parent 5338ae3 commit a2ab533

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

edward2/tensorflow/constraints.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def serialize(initializer):
8484
def deserialize(config, custom_objects=None):
8585
return tf.keras.utils.deserialize_keras_object(
8686
config,
87-
module_objects=globals(),
8887
custom_objects=custom_objects,
8988
printable_module_name='constraints')
9089

edward2/tensorflow/initializers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def __init__(self,
138138
distribution: Random distribution to use. One of "truncated_normal", or
139139
"untruncated_normal".
140140
seed: A Python integer. Used to create random seeds. See
141-
`tf.set_random_seed`
142-
for behavior.
141+
`tf.set_random_seed` for behavior.
143142
144143
Raises:
145144
ValueError: In case of an invalid value for the "scale", mode" or
@@ -529,7 +528,9 @@ def get_config(self):
529528

530529

531530
class TrainableHeNormal(TrainableNormal):
532-
"""Trainable normal initialized per He et al. 2015, given a ReLU nonlinearity.
531+
"""Trainable normal initialized per He et al.
532+
533+
2015, given a ReLU nonlinearity.
533534
534535
The distribution is initialized to a Normal scaled by `sqrt(2 / fan_in)`,
535536
where `fan_in` is the number of input units. A ReLU nonlinearity is assumed
@@ -857,7 +858,6 @@ def serialize(initializer):
857858
def deserialize(config, custom_objects=None):
858859
return tf.keras.utils.deserialize_keras_object(
859860
config,
860-
module_objects=globals(),
861861
custom_objects=custom_objects,
862862
printable_module_name='initializers')
863863

edward2/tensorflow/regularizers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ def serialize(initializer):
394394
def deserialize(config, custom_objects=None):
395395
return tf.keras.utils.deserialize_keras_object(
396396
config,
397-
module_objects=globals(),
398397
custom_objects=custom_objects,
399398
printable_module_name='regularizers')
400399

0 commit comments

Comments
 (0)