Skip to content

torch.nn.BatchNorm1d转换问题 #604

@zhiminzhang0830

Description

@zhiminzhang0830

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参数。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions