Addons: Migrate register_keras_custom_object to core

Created on 22 Aug 2019  路  5Comments  路  Source: tensorflow/addons

TensorFlow version (you are using): All
TensorFlow Addons version: head
Is it in the tf.contrib (if so, where): N/A
Are you willing to contribute it (yes/no): Yes
Are you willing to maintain it going forward? (yes/no): Yes

Describe the feature and the current behavior/state.
The Tensorflow Text team is interested in being able to register custom Keras serializables. This functionality is in addons at https://github.com/tensorflow/addons/blob/9c671021ba422be8077f3c3ff1d7765947388a0f/tensorflow_addons/utils/keras_utils.py#L23.

Will this change the current api? How?
Yes. The internal implementation will handle custom names (not simply cls.__name__) and will require objects to have a package in their name (following https://github.com/tensorflow/community/pull/126/files#diff-91eaafbf41ccf12b96fe24b158113068). Users will still be able to invoke the decorator with no args, which will register the object under "Custom>cls.__name__". (This is an API break with the exisiting registration, unfortunately, but can be worked around by editing the global name dictionary if necessary.)

Any Other info.
@seanpmorgan -- thoughts?

migration-request

Most helpful comment

All 5 comments

Makes sense to me that this functionality be moved to core. Addons is still very much in beta so modifying the serialized object names is fine with us.

CC Keras team for inputs / see if they agree with this migration
@fchollet @karmel

+1 from the Keras side-- thanks, all--

I suppose tf.keras.utils.register_keras_serializable is ready in keras now.

@seanpmorgan @karmel @markomernick Could anyone confirm this? Thank you!

Closing this as a public API is now available in TF core. See https://github.com/tensorflow/addons/issues/664

Was this page helpful?
0 / 5 - 0 ratings