Skip to content

LossHandler does not handle two different sets on the same network key #198

@tsirif

Description

@tsirif

I have come to realize by the implementation in built_ins/gan.py that two separate calls are done in order to update the discriminator. The first optimizer update utilizes the gan loss and the second the gradient penalty.

This is because LossHandle will overwrite (s1) any value for a specific network key, which is an inconvenient behaviour. I can see in s2 and s3 that there was an intention to implement a convenient behaviour, but it seems that it has not been done.

I propose the following, tell me what you think:

  • self.losses.network = a will overwrite/set the loss for the network.
  • self.losses.network += a would add to the already existing loss, if it exists, and if it doesn't it sets it to a.
  • Remove any options for method or add_value=True as it would only introduce confusion and incoherencies to the API for those creating ModelPlugins.

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