// TODO(kathywu): Synchronize with the keras spec (go/keras-json-spec) once
// the python config serialization has caught up.
metadata = dict(
class_name=generic_utils.get_registered_name(type(self.obj)),
name=self.obj.name,
trainable=self.obj.trainable,
expects_training_arg=self.obj._expects_training_arg, // pylint: disable=protected-access
dtype=policy.serialize(self.obj._dtype_policy), // pylint: disable=protected-access
batch_input_shape=getattr(self.obj, "_batch_input_shape", None),
stateful=self.obj.stateful,
must_restore_from_config=self.obj._must_restore_from_config, // pylint: disable=protected-access
)
metadata.update(get_config(self.obj))
if self.obj.input_spec is not None:
// Layer"s input_spec has already been type-checked in the property setter.
metadata["input_spec"] = nest.map_structure(
lambda x: generic_utils.serialize_keras_object(x) if x else None,
After Change
must_restore_from_config=self.obj._must_restore_from_config, // pylint: disable=protected-access
)
metadata.update(get_serialized(self.obj))
if self.obj.input_spec is not None:
// Layer"s input_spec has already been type-checked in the property setter.
metadata["input_spec"] = nest.map_structure(
lambda x: generic_utils.serialize_keras_object(x) if x else None,