Args: momentum (float): Factor used in computing the running mean and variance.
(self, *args, momentum=0.9)
| 805 | """ |
| 806 | |
| 807 | def __init__(self, *args, momentum=0.9): |
| 808 | """ |
| 809 | Args: |
| 810 | momentum (float): Factor used in computing the running mean and |
| 811 | variance. |
| 812 | """ |
| 813 | super(BatchNorm2d, self).__init__() |
| 814 | |
| 815 | if len(args) > 0: |
| 816 | self.channels = args[0] |
| 817 | if len(args) > 1: |
| 818 | self.momentum = args[1] |
| 819 | self.momentum = momentum |
| 820 | assert 0 <= momentum <= 1.0, ("Illegal momentum") |
| 821 | |
| 822 | def initialize(self, x): |
| 823 | self.channels = x.shape[1] |