Skip to content

Override super step function#9

Open
mimoralea wants to merge 1 commit intogreydanus:masterfrom
mimoralea:patch-1
Open

Override super step function#9
mimoralea wants to merge 1 commit intogreydanus:masterfrom
mimoralea:patch-1

Conversation

@mimoralea
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@QasimWani QasimWani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if p.grad is None: continue always returns None.

See issue #11

Comment on lines +72 to +77
def step(self, closure=None):
for group in self.param_groups:
for p in group['params']:
if p.grad is None: continue
self.state[p]['shared_steps'] += 1
self.state[p]['step'] = self.state[p]['shared_steps'][0] - 1 # a "step += 1" comes later
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def step(self, closure=None):
for group in self.param_groups:
for p in group['params']:
if p.grad is None: continue
self.state[p]['shared_steps'] += 1
self.state[p]['step'] = self.state[p]['shared_steps'][0] - 1 # a "step += 1" comes later

if p.grad is None: continue always returns None.

Therefore,

self.state[p]['shared_steps'] += 1
self.state[p]['step'] = self.state[p]['shared_steps'][0] - 1

is never executed.
why did u override this then in the first place step()? if you look at pytorch's default implementation, it doesn't seem to conflict with the general A3C model.
In reference to the following issue: #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants