Skip to content

fix(utils): get_scheduler returns NotImplementedError (+1 more) - #94

Open
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/utils-assorted-c9e54215
Open

fix(utils): get_scheduler returns NotImplementedError (+1 more)#94
andrewwhitecdw wants to merge 1 commit into
NVlabs:masterfrom
andrewwhitecdw:bugfix/utils-assorted-c9e54215

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

Small fixes in utils.py:

fix: get_scheduler returns NotImplementedError instead of raising

Fix: Replace:

    else:
        return NotImplementedError('learning rate policy [%s] is not implemented', hyperparameters['lr_policy'])

with:

    else:
        raise NotImplementedError('learning rate policy [%s] is not implemented' % hyperparameters['lr_policy'])

fix: vgg_preprocess uses type(batch.data) which breaks in modern PyTorch

Fix: Replace:

def vgg_preprocess(batch):
    tensortype = type(batch.data)
    (r, g, b) = torch.chunk(batch, 3, dim = 1)
    batch = torch.cat((b, g, r), dim = 1) # convert RGB to BGR
    batch = (batch + 1) * 255 * 0.5 # [-1, 1] -> [0, 255]
    mean = tensortype(batch.data.size())

with:

def vgg_preprocess(batch):
    (r, g, b) = torch.chunk(batch, 3, dim = 1)
    batch = torch.cat((b, g, r), dim = 1) # convert RGB to BGR
    batch = (batch + 1) * 255 * 0.5 # [-1, 1] -> [0, 255]
    mean = torch.empty(batch.data.size(), dtype=batch.dtype, device=batch.device)

Files changed

  • utils.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review August 3, 2026 22:10
@andrewwhitecdw

Copy link
Copy Markdown
Author

Closing this sweep-generated PR: sole commit is missing a valid Signed-off-by trailer. It does not meet the sweep requirements (single signed-off commit).

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