Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switches Keras object serialization to new logic and changes public API for deserialize_keras_object/serialize_keras_object to the new functions. #542

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion edward2/tensorflow/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def serialize(initializer):
def deserialize(config, custom_objects=None):
return tf.keras.utils.deserialize_keras_object(
config,
module_objects=globals(),
custom_objects=custom_objects,
printable_module_name='constraints')

Expand Down
8 changes: 4 additions & 4 deletions edward2/tensorflow/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ def __init__(self,
distribution: Random distribution to use. One of "truncated_normal", or
"untruncated_normal".
seed: A Python integer. Used to create random seeds. See
`tf.set_random_seed`
for behavior.
`tf.set_random_seed` for behavior.

Raises:
ValueError: In case of an invalid value for the "scale", mode" or
Expand Down Expand Up @@ -529,7 +528,9 @@ def get_config(self):


class TrainableHeNormal(TrainableNormal):
"""Trainable normal initialized per He et al. 2015, given a ReLU nonlinearity.
"""Trainable normal initialized per He et al.

2015, given a ReLU nonlinearity.

The distribution is initialized to a Normal scaled by `sqrt(2 / fan_in)`,
where `fan_in` is the number of input units. A ReLU nonlinearity is assumed
Expand Down Expand Up @@ -857,7 +858,6 @@ def serialize(initializer):
def deserialize(config, custom_objects=None):
return tf.keras.utils.deserialize_keras_object(
config,
module_objects=globals(),
custom_objects=custom_objects,
printable_module_name='initializers')

Expand Down
1 change: 0 additions & 1 deletion edward2/tensorflow/regularizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ def serialize(initializer):
def deserialize(config, custom_objects=None):
return tf.keras.utils.deserialize_keras_object(
config,
module_objects=globals(),
custom_objects=custom_objects,
printable_module_name='regularizers')

Expand Down