syncbn.rst 1.14 KB
Newer Older
Hang Zhang's avatar
Hang Zhang committed
1
2
3
4
5
6
7
.. role:: hidden
    :class: hidden-section

Synchronized BatchNorm
======================

The current BN is implementated insynchronized accross the gpus, which is a big problem for memory consuming tasks such as Semantic Segmenation, since the mini-batch is very small. 
Hang Zhang's avatar
v0.1.0  
Hang Zhang committed
8
To synchronize the batchnorm accross multiple gpus is not easy to implment within the current Dataparallel framework. We address this difficulty by making each layer 'self-parallel' :class:`encoding.parallel.SelfDataParallel`, that is accepting the inputs from multi-gpus. Therefore, we can handle the synchronizing across gpus.
Hang Zhang's avatar
Hang Zhang committed
9

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

.. currentmodule:: encoding.nn

Modules
-------

:hidden:`BatchNorm1d`
~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: BatchNorm1d
    :members:

:hidden:`BatchNorm2d`
~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: BatchNorm2d
    :members:


Hang Zhang's avatar
Hang Zhang committed
29
30
.. currentmodule:: encoding

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
31

Hang Zhang's avatar
Hang Zhang committed
32
33
34
Functions
---------

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
35
36
37
.. currentmodule:: encoding.functions


Hang Zhang's avatar
Hang Zhang committed
38
39
40
:hidden:`batchnormtrain`
~~~~~~~~~~~~~~~~~~~~~~~~

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
41
.. autofunction:: batchnormtrain
Hang Zhang's avatar
Hang Zhang committed
42
43
44
45

:hidden:`batchnormeval`
~~~~~~~~~~~~~~~~~~~~~~~

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
46
.. autofunction:: batchnormeval
Hang Zhang's avatar
Hang Zhang committed
47
48
49
50

:hidden:`sum_square`
~~~~~~~~~~~~~~~~~~~~

Hang Zhang's avatar
v1.0.1  
Hang Zhang committed
51
.. autofunction:: sum_square
Hang Zhang's avatar
Hang Zhang committed
52