torch.nn.BatchNorm2d()的使用

参考链接: class torch.nn.BatchNorm2d(num_features, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)

torch.nn.BatchNorm2d()的使用_第1张图片

实验代码展示:

Microsoft Windows [版本 10.0.18363.1316]
(c) 2019 Microsoft Corporation。保留所有权利。

C:\Users\chenxuqi>conda activate ssd4pytorch1_2_0

(ssd4pytorch1_2_0) C:\Users\chenxuqi>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.manual_seed(seed=20200910)
<torch._C.Generator object at 0x000002298027D330>
>>>
>>> from torch import nn
>>> model = nn.BatchNorm2d(100)
>>>
>>> data_in = torch.randn(20,100,35,45)
>>> data_in.shape
torch.Size([20, 100, 35, 45])
>>>
>>> data_out = model(data_in)
>>> data_out.shape
torch.Size([20, 100, 35, 45])
>>>
>>> model = nn.BatchNorm2d(120)
>>>
>>>
>>>
>>>

你可能感兴趣的:(torch.nn.BatchNorm2d()的使用)