Skip to content
This repository was archived by the owner on Oct 16, 2022. It is now read-only.
This repository was archived by the owner on Oct 16, 2022. It is now read-only.

actor critic possible error #2

Description

@hawkeoni

Hello, Ben!
Thank you for a great tutorial series. I have a question regarding your actor-critic notebook.
In function update_policy

def update_policy(returns, log_prob_actions, values, optimizer):

    returns = returns.detach()
    
    policy_loss = - (returns * log_prob_actions).sum()
    
    value_loss = F.smooth_l1_loss(returns, values).sum()
    
    optimizer.zero_grad()
    
    policy_loss.backward()
    value_loss.backward()
    
    optimizer.step()
    
    return policy_loss.item(), value_loss.item()

in policy loss you calculate the usual policy gradient for agent, in value loss you calculate loss for the critic. They seem to be independent, the critic does not affect the agent at all. Shouldn't returns for policy loss be calculated with values from critic or something like that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions