Skip to content

[Accuracy diff No.109] Fix batch_norm mapping - #402

Merged
cangtianhuang merged 1 commit into
PFCCLab:mainfrom
zrr1999:acc/batch_norm
Jul 21, 2025
Merged

cangtianhuang merged 1 commit into
PFCCLab:mainfrom
zrr1999:acc/batch_norm

Conversation

@zrr1999

@zrr1999 zrr1999 commented Jul 21, 2025 •

Copy link
Copy Markdown
Collaborator

由于 pytorch 的batch_norm API 没有 use_global_stats 或 track_running_stats 参数(pytorch在class层面实现的),所以使用 training if use_global_stats is None else not use_global_stats 来替代 training 可以保证pytorch行为 与 paddle行为一致。
修改后 pytorch 行为如下
1
training = False
track_running_stats =True
使用全局
2
training = False
track_running_stats = False
不使用全局
3
training = True
track_running_stats = True
使用全局
4
training = True
track_running_stats = False
不使用全局

@paddle-bot

paddle-bot Bot commented Jul 21, 2025

Copy link
Copy Markdown

Thanks for your contribution!

@zrr1999 zrr1999 changed the title Fix batch_norm mapping [Accuracy diff No.109] Fix batch_norm mapping Jul 21, 2025

@cangtianhuang cangtianhuang left a comment

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.

LGTM

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.

2 participants