-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
SpectralNormalization #17648
SpectralNormalization #17648
Conversation
Thanks for the PR! We have recently ported a number of classes from TFAddons to core Keras. However for each class we ended up doing pretty extensive style changes and we increased test coverage. If we were to bring SpectralNormalization into Keras it would require further work. However I am not sure we should do it. Our observation was that SpectralNormalization was getting very little usage, in terms of pageviews to the TFAddons docs. It didn't seem to meet our threshold for the kind of APIs we host in core Keras. Are you aware of any important use cases? |
I think it is a useful layer. Please look at paper: https://arxiv.org/abs/1802.05957. PyTorch includes by default: https://paperswithcode.com/paper/spectral-normalization-for-generative |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good -- the citation count is pretty convincing.
) | ||
|
||
def get_config(self): | ||
config = {"power_iterations": self.power_iterations} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't include the layer being wrapped, it won't properly deserialize. Is this tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only power_iterations
was tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Looking good. Some minor nits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you for the contribution!
@haifeng-jin All is repaired. Thanks. |
Imported from GitHub PR #17648 Hello, here is the adapted `SpectralNormalization` from TF-Addons implementation. Thanks. Copybara import of the project: -- 0ae1ae7 by Martin Kubovcik <markub3327@gmail.com>: + SpectralNormalization -- 7f91062 by Martin Kubovcik <markub3327@gmail.com>: fixes -- 5fbe19e by Martin Kubovcik <markub3327@gmail.com>: fix -- f57b45a by Martin Kubovcik <markub3327@gmail.com>: update -- 46269ea by Martin Kubovcik <markub3327@gmail.com>: update tests Merging this change closes #17648 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17648 from markub3327:keras-update 46269ea PiperOrigin-RevId: 519773515
Imported from GitHub PR #17648 Hello, here is the adapted `SpectralNormalization` from TF-Addons implementation. Thanks. Copybara import of the project: -- 0ae1ae7 by Martin Kubovcik <markub3327@gmail.com>: + SpectralNormalization -- 7f91062 by Martin Kubovcik <markub3327@gmail.com>: fixes -- 5fbe19e by Martin Kubovcik <markub3327@gmail.com>: fix -- f57b45a by Martin Kubovcik <markub3327@gmail.com>: update -- 46269ea by Martin Kubovcik <markub3327@gmail.com>: update tests Merging this change closes #17648 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17648 from markub3327:keras-update 46269ea PiperOrigin-RevId: 519773515
Imported from GitHub PR #17648 Hello, here is the adapted `SpectralNormalization` from TF-Addons implementation. Thanks. Copybara import of the project: -- 0ae1ae7 by Martin Kubovcik <markub3327@gmail.com>: + SpectralNormalization -- 7f91062 by Martin Kubovcik <markub3327@gmail.com>: fixes -- 5fbe19e by Martin Kubovcik <markub3327@gmail.com>: fix -- f57b45a by Martin Kubovcik <markub3327@gmail.com>: update -- 46269ea by Martin Kubovcik <markub3327@gmail.com>: update tests Merging this change closes #17648 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17648 from markub3327:keras-update 46269ea PiperOrigin-RevId: 519773515
Imported from GitHub PR #17648 Hello, here is the adapted `SpectralNormalization` from TF-Addons implementation. Thanks. Copybara import of the project: -- 0ae1ae7 by Martin Kubovcik <markub3327@gmail.com>: + SpectralNormalization -- 7f91062 by Martin Kubovcik <markub3327@gmail.com>: fixes -- 5fbe19e by Martin Kubovcik <markub3327@gmail.com>: fix -- f57b45a by Martin Kubovcik <markub3327@gmail.com>: update -- 46269ea by Martin Kubovcik <markub3327@gmail.com>: update tests Merging this change closes #17648 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17648 from markub3327:keras-update 46269ea PiperOrigin-RevId: 519773515
PiperOrigin-RevId: 520171696
Imported from GitHub PR keras-team/keras#17648 Hello, here is the adapted `SpectralNormalization` from TF-Addons implementation. Thanks. Copybara import of the project: -- 0ae1ae70024b548fc2aee47c976ca4c30530157f by Martin Kubovcik <markub3327@gmail.com>: + SpectralNormalization -- 7f91062eea8d23f6407a2c3bc253e82e48a52e30 by Martin Kubovcik <markub3327@gmail.com>: fixes -- 5fbe19ecadbdf69acb13f1b3aac3c411b1427c83 by Martin Kubovcik <markub3327@gmail.com>: fix -- f57b45aa5a635a3d75ec957e9ca3f7ce5984421c by Martin Kubovcik <markub3327@gmail.com>: update -- 46269ea5fc5d404051c47a7eadcd42acd2a62ad6 by Martin Kubovcik <markub3327@gmail.com>: update tests Merging this change closes #17648 PiperOrigin-RevId: 520171696
@haifeng-jin mind taking a look what's being blocked here? |
Probably, we should just click "Merge pull request" here since copybara missed it. |
Are you sure this spectral normalization works correctly? It seems like it's the same tfa implementation, which is wrong @fchollet |
Hello,
here is the adapted
SpectralNormalization
from TF-Addons implementation.Thanks.