PaddlePaddle / PaddlePaddle/PaConvert

torch.nn.BatchNorm1d转换问题

Open
#604 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
122
Forks
98
PR merge metrics
No merged PRs in 30d

Description

torch.nn.BatchNorm1d转换时会丢失track_running_stats,demo如下。

paconvert版本:3.0.1

原Torch代码:

import torch

in_channels = 10
eps = 1e-5
momentum = 0.1
affine = True
track_running_stats = True

net = torch.nn.BatchNorm1d(in_channels, eps, momentum, affine,
                                           track_running_stats)

转换后的Paddle代码:

import paddle

in_channels = 10
eps = 1e-05
momentum = 0.1
affine = True
track_running_stats = True
net = paddle.nn.BatchNorm1D(
    num_features=in_channels,
    epsilon=eps,
    weight_attr=affine,
    bias_attr=affine,
    momentum=1 - momentum,
)

从转换结果看,转换后的代码丢失了track_running_stats参数。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shown torch.nn.BatchNorm1d conversion with PaConvert 3.0.1, then locate the conversion rule handling BatchNorm1d and its regression tests. Done means the generated Paddle code preserves the source track_running_stats behavior and a test covers this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.