tensorflow / addons

Useful extra functionality for TensorFlow 2.x maintained by SIG-addons
Apache License 2.0
1.69k stars 610 forks source link

Update embedding_bag.py for save_model in 'tf' mode #2804

Closed AlexanderLavelle closed 1 year ago

AlexanderLavelle commented 1 year ago

self.input_length is not defined, which affects the pickling / unpickling of this layer in tf model mode.

Description

Brief Description of the PR:

Of the two options of adding input_length or removing it entirely, it seems more elegant to remove it. The attribute input_length was likely ported from TF Embedding Layer, where it might be necessary; however, in EmbeddingBag there does not appear to be such requirements.

The alternative way to solve the issue is to take input_length as an int argument set to None but this seems likely to be more confusing and would additionally require a modification to the documentation

Fixes # (issue) 2803

Type of change

Checklist:

How Has This Been Tested?

If you're adding a bugfix or new feature please describe the tests that you ran to verify your changes:

bot-of-gabrieldemarmiesse commented 1 year ago

@rocketknight1

You are owner of some files modified in this pull request. Would you kindly review the changes whenever you have the time to? Thank you very much.