Skip to content

fix: gamma==1 ignores mul and clip parameters - #123

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/losses-gamma-1-ignores-mul-and-clip-parameters
Open

fix: gamma==1 ignores mul and clip parameters#123
andrewwhitecdw wants to merge 1 commit into
NVlabs:mainfrom
andrewwhitecdw:bugfix/losses-gamma-1-ignores-mul-and-clip-parameters

Conversation

@andrewwhitecdw

Copy link
Copy Markdown

Problem

fix: gamma==1 ignores mul and clip parameters

Fix

Replace:

    if offset is None:
        if gamma == 1:
            return l1_loss
        # d(x**p)/dx = 1 ==> p * x**(p-1) == 1 ==> x = (1/p)**(1/(p-1))
        offset = (1 / gamma)**(1 / (gamma - 1))

with:

    if offset is None:
        if gamma == 1:
            def loss_func(x, y):
                return mul * l1_loss(x, y).clip(max=clip)
            return loss_func
        # d(x**p)/dx = 1 ==> p * x**(p-1) == 1 ==> x = (1/p)**(1/(p-1))
        offset = (1 / gamma)**(1 / (gamma - 1))

Files changed

  • mast3r/cloud_opt/utils/losses.py

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.

1 participant