This repository was archived by the owner on Jul 7, 2023. It is now read-only.
update multistep_optimizer for tensorflow gpu #1773
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
I found by using the original class
MultistepAdamOptimizer
, I got a problem ofinvalidArgumentError: Cannot assign a device for operation
(see details below). This problem is only for tensorflow-gpu. On tensorflow it works fine. I did a lot of investigation on this (e.g. try adding normal soft placementtf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=True
)) - the trick people recommended without success).After investigation I found two actions needed to fix this issue. 1. Convert int to float, and 2. The class inherits directly from
optimizer.Optimizer
, notAdamOptimizer
. With this I found it solved the issue. Note that without any of these twos it will not work.Let me know if you have any question regarding to this pull request. Meanwhile let me know if you need the code to replicate the issue of invalidArgumentError. Feel free if you think you could find a better solution.
Finally, I tagged @fstahlberg as well as he wrote the original
MultistepAdamOptimizer
class so that he will aware of this issue.Thank you!
A subpiece of the error: