(self, x: th.Tensor)
| 920 | } |
| 921 | |
| 922 | def scale_channels(self, x: th.Tensor) -> th.Tensor: |
| 923 | if self.channel_scales is not None: |
| 924 | x = x * th.from_numpy(self.channel_scales).to(x).reshape( |
| 925 | [1, -1, *([1] * (len(x.shape) - 2))] |
| 926 | ) |
| 927 | if self.channel_biases is not None: |
| 928 | x = x + th.from_numpy(self.channel_biases).to(x).reshape( |
| 929 | [1, -1, *([1] * (len(x.shape) - 2))] |
| 930 | ) |
| 931 | return x |
| 932 | |
| 933 | def unscale_channels(self, x: th.Tensor) -> th.Tensor: |
| 934 | if self.channel_biases is not None: |