Skip to content

Instantly share code, notes, and snippets.

@elumixor
Created May 24, 2020 23:32
Show Gist options
  • Save elumixor/169a68cbe29aa0d1cb487cf932915e7b to your computer and use it in GitHub Desktop.
Save elumixor/169a68cbe29aa0d1cb487cf932915e7b to your computer and use it in GitHub Desktop.
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