Skip to content

fix(networks): invalid decoder type silently ignored (+3 more) - #84

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/networks-assorted-a39e3d85
Open

fix(networks): invalid decoder type silently ignored (+3 more)#84
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/networks-assorted-a39e3d85

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in networks.py:

fix: invalid decoder type silently ignored

Fix: Replace:

        else:
            ('unkonw decoder type')

with:

        else:
            raise ValueError('unknown decoder type')

fix: invalid resblock type silently ignored

Fix: Replace:

        else:
            ('unkown block type')

with:

        else:
            raise ValueError('unknown block type')

fix: LayerNorm fp16 normalizes across batch

Fix: Replace:

        if x.type() == 'torch.cuda.HalfTensor': # For Safety
            mean = x.view(-1).float().mean().view(*shape)
            std = x.view(-1).float().std().view(*shape)
            mean = mean.half()
            std = std.half()

with:

        if x.type() == 'torch.cuda.HalfTensor': # For Safety
            mean = x.view(x.size(0), -1).float().mean(1).view(*shape).half()
            std = x.view(x.size(0), -1).float().std(1).view(*shape).half()

fix: WGAN drift penalty uses sum not mean

Fix: Replace:

            # progressive gan
            loss += Drift*( torch.sum(outs0**2) + torch.sum(outs1**2))

with:

            # progressive gan
            loss += Drift*( torch.mean(outs0**2) + torch.mean(outs1**2))

Files changed

  • networks.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:10
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