def get_config(self):
     """Returns the config of the dropout wrapper."""
     config = {
         "input_keep_prob": self._input_keep_prob,
         "output_keep_prob": self._output_keep_prob,
         "state_keep_prob": self._state_keep_prob,
         "variational_recurrent": self._variational_recurrent,
         "input_size": self._input_size,
         "seed": self._seed,
     }
     if self._dropout_state_filter != _default_dropout_state_filter_visitor:
         (
             function,
             function_type,
             function_module,
         ) = _serialize_function_to_config(self._dropout_state_filter)
         config.update(
             {
                 "dropout_fn": function,
                 "dropout_fn_type": function_type,
                 "dropout_fn_module": function_module,
             }
         )
     base_config = super().get_config()
     return dict(list(base_config.items()) + list(config.items()))
Example #2
0
 def get_config(self):
     """Returns the config of the residual wrapper."""
     if self._residual_fn is not None:
         function, function_type, function_module = _serialize_function_to_config(
             self._residual_fn)
         config = {
             "residual_fn": function,
             "residual_fn_type": function_type,
             "residual_fn_module": function_module
         }
     else:
         config = {}
     base_config = super().get_config()
     return dict(list(base_config.items()) + list(config.items()))