Commit a355f4f0 authored by Gunnlaugur Thor Briem's avatar Gunnlaugur Thor Briem
Browse files

Add functools.wraps for wrapper initializer

Preserve the original initializer function's metadata. See
https://docs.python.org/3/library/functools.html#functools.update_wrapper
parent d262a5d4
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
"""TF general model utils.""" """TF general model utils."""
import functools
import logging import logging
import os import os
...@@ -54,6 +53,7 @@ def keras_serializable(cls): ...@@ -54,6 +53,7 @@ def keras_serializable(cls):
if config_class is None: if config_class is None:
raise AttributeError("Must set `config_class` to use @keras_serializable") raise AttributeError("Must set `config_class` to use @keras_serializable")
@functools.wraps(initializer)
def wrapped_init(self, config, *args, **kwargs): def wrapped_init(self, config, *args, **kwargs):
if isinstance(config, dict): if isinstance(config, dict):
config = config_class.from_dict(config) config = config_class.from_dict(config)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment