(self, input)
| 54 | self.register_buffer("initialized", torch.tensor(0, dtype=torch.uint8)) |
| 55 | |
| 56 | def initialize(self, input): |
| 57 | with torch.no_grad(): |
| 58 | flatten = input.permute(1, 0, 2, 3).contiguous().view(input.shape[1], -1) |
| 59 | mean = flatten.mean(1).unsqueeze(1).unsqueeze(2).unsqueeze(3).permute(1, 0, 2, 3) |
| 60 | std = flatten.std(1).unsqueeze(1).unsqueeze(2).unsqueeze(3).permute(1, 0, 2, 3) |
| 61 | |
| 62 | self.loc.data.copy_(-mean) |
| 63 | self.scale.data.copy_(1 / (std + 1e-6)) |
| 64 | |
| 65 | def forward(self, input, reverse=False): |
| 66 | if reverse: |
no outgoing calls
no test coverage detected