Created
May 24, 2020 23:32
-
-
Save elumixor/169a68cbe29aa0d1cb487cf932915e7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def apply_update(grad_flattened): | |
n = 0 | |
for p in actor.parameters(): | |
numel = p.numel() | |
g = grad_flattened[n:n + numel].view(p.shape) | |
p.data += g | |
n += numel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment