Skip to content

[API Compatibility] Add Four api: torch.nn.Module.register_forward_hook, torch.nn.Module.register_forward_pre_hook, torch.nn.modules.module._IncompatibleKeys and torch.optim.lr_scheduler.LRScheduler - #905

Merged
zhwesky2010 merged 2 commits into
PaddlePaddle:masterfrom
Manfredss:api_add
Jul 27, 2026

Conversation

@Manfredss

Copy link
Copy Markdown
Collaborator

PR Docs

Add torch.optim.lr_scheduler.LRScheduler and torch.nn.modules.module._IncompatibleKeys in api_mapping.json, change torch.nn.Module.register_forward_hook and torch.nn.Module.register_forward_pre_hook to ChangePrefixMatcher. Add test file for torch.optim.lr_scheduler.LRScheduler

PR APIs

torch.nn.Module.register_forward_hook
torch.nn.Module.register_forward_pre_hook
torch.nn.modules.module._IncompatibleKeys
torch.optim.lr_scheduler.LRScheduler

…h.optim.lr_scheduler.LRSchedule, add test file for torch.optim.lr_scheduler.LRSchedule
…ch.nn.Module.register_forward_pre_hook, enhance their tests
@paddle-bot

paddle-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label Jul 24, 2026
@Manfredss Manfredss self-assigned this Jul 24, 2026
@Manfredss
Manfredss requested a review from zhwesky2010 July 24, 2026 09:12
scheduler = {scheduler_init}
loss = parameter.sum()
loss.backward()
optimizer.step()

@zhwesky2010 zhwesky2010 Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scheduler需要手动调用下step,不然不会触发get_lr

scheduler.step()

后面PR完善下吧

@zhwesky2010
zhwesky2010 merged commit b7cbb6d into PaddlePaddle:master Jul 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants