Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SequenceLoss shoudn't override the __call__ of tf.keras.losses.Loss #1459

Open
gabrieldemarmiesse opened this issue Mar 27, 2020 · 2 comments
Labels
blocked Pending something elses completion losses seq2seq

Comments

@gabrieldemarmiesse
Copy link
Member

Everything is in the title. __call__ is considered a private API of keras. For TF 2.2 we had to change our code which shows that we shoudn't rely on the behavior of __call__.

Follow-up on #1371 (comment)

@guillaumekln @pavithrasv @qlzh727 are the persons who might be concerned by this issue.

@ashutosh1919
Copy link
Contributor

@gabrieldemarmiesse , __call__ is passing some class variables to sequence_loss() function. What is the right way to remove __call__? Can we include method build() to store these class variables in SequenceLoss class and remove __call__ and call sequence_loss in call() method ?

@guillaumekln
Copy link
Contributor

We override the __call__ method to access the sample_weight argument and support various reduction strategies that are not covered by the reduction argument of tf.keras.losses.Loss. I'm not aware of any workaround at the moment that would keep the same features, so I'm marking this as blocked.

@guillaumekln guillaumekln added the blocked Pending something elses completion label Jun 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Pending something elses completion losses seq2seq
Projects
None yet
Development

No branches or pull requests

4 participants