BatchNorm.md 1.1 KB
Newer Older
S
sunyanfang01 已提交
1 2 3 4 5 6 7 8 9 10
## BatchNorm


### [BatchNorm](http://caffe.berkeleyvision.org/tutorial/layers/batchnorm.html)
```
layer {
    name: "bn"
    type: "BatchNorm"
    bottom: "data"
    top: "bn"
S
SunAhong1993 已提交
11
    batch_norm_param {
S
sunyanfang01 已提交
12 13 14 15 16 17 18 19 20 21 22 23
        use_global_stats: true
    	moving_average_fraction: 0.999
    	eps: 0.00001
    }
}
```


### [paddle.fluid.layers.batch_norm](http://paddlepaddle.org/documentation/docs/zh/1.3/api_cn/layers_cn.html#permalink-36-batch_norm)
```python
paddle.fluid.layers.batch_norm(
    input, 
S
SunAhong1993 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37
    act = None, 
    is_test = False, 
    momentum = 0.9, 
    epsilon = 1e-05, 
    param_attr = None, 
    bias_attr = None, 
    data_layout = 'NCHW', 
    in_place = False, 
    name = None, 
    moving_mean_name = None, 
    moving_variance_name = None, 
    do_model_average_for_mean_and_var = False, 
    fuse_with_relu = False, 
    use_global_stats = False
S
sunyanfang01 已提交
38 39 40 41
)
```  

### 功能差异
J
Jason 已提交
42
#### 计算机制
J
Jason 已提交
43
Caffe:`BatchNorm`仅做了归一化计算,需结合`Scale`层进行缩放变换;  
J
Jason 已提交
44
PaddlePaddle:包括归一化计算和缩放变换,`param_attr``bias_attr`即为缩放变换的设置参数。