@@ -23,9 +23,6 @@ def forward(self, x):
23
23
24
24
25
25
LayerCentering2d = LayerCentering
26
- # class LayerCentering2D(LayerCentering):
27
- # def __init__(self, size = 1, dim=[-2,-1]):
28
- # super(LayerCentering2D, self).__init__(size = size,dim=[-2,-1])
29
26
30
27
31
28
class BatchCentering (nn .Module ):
@@ -72,25 +69,4 @@ def forward(self, x):
72
69
return x - mean .view (mean_shape )
73
70
74
71
75
- # class BatchCenteringBiases(BatchCentering):
76
- # def __init__(self, size =1, dim=[0,-2,-1], momentum=0.05):
77
- # super(BatchCenteringBiases, self).__init__(size = size, dim = dim, momentum = momentum)
78
- # if isinstance(size, tuple):
79
- # self.alpha = nn.Parameter(torch.zeros(size), requires_grad=True)
80
- # else:
81
- # self.alpha = nn.Parameter(torch.zeros(1,size,1,1), requires_grad=True)
82
-
83
- # def forward(self, x):
84
- # #print(x.mean(dim=self.dim, keepdim=True).abs().mean().cpu().numpy(), self.running_mean.abs().cpu().mean().numpy(), self.alpha.abs().mean().cpu().numpy())
85
- # #print(x.mean(dim=self.dim, keepdim=True).abs().mean().cpu().numpy(),(x.mean(dim=self.dim, keepdim=True)-self.running_mean).abs().mean().cpu().numpy())
86
- # return super().forward(x) + self.alpha
87
-
88
72
BatchCentering2d = BatchCentering
89
-
90
- # class BatchCenteringBiases2D(BatchCenteringBiases):
91
- # def __init__(self, size =1, momentum=0.05):
92
- # super(BatchCenteringBiases2D, self).__init__(size = size, dim=[0,-2,-1],momentum=momentum)
93
-
94
- # class BatchCentering2D(BatchCentering):
95
- # def __init__(self, size =1, momentum=0.05):
96
- # super(BatchCentering2D, self).__init__(size = size, dim=[0,-2,-1],momentum=momentum)
0 commit comments