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
This commit is contained in:
Gunnlaugur Thor Briem 2020-03-05 11:11:42 +00:00
parent d262a5d48e
commit a355f4f0fc

View File

@ -14,8 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""TF general model utils."""
import functools
import logging
import os
@ -54,6 +53,7 @@ def keras_serializable(cls):
if config_class is None:
raise AttributeError("Must set `config_class` to use @keras_serializable")
@functools.wraps(initializer)
def wrapped_init(self, config, *args, **kwargs):
if isinstance(config, dict):
config = config_class.from_dict(config)