| 5 | import math |
| 6 | |
| 7 | class Transpose(nn.Module): |
| 8 | def __init__(self, *dims, contiguous=False): |
| 9 | super().__init__() |
| 10 | self.dims, self.contiguous = dims, contiguous |
| 11 | def forward(self, x): |
| 12 | if self.contiguous: return x.transpose(*self.dims).contiguous() |
| 13 | else: return x.transpose(*self.dims) |
| 14 | |
| 15 | |
| 16 | def get_activation_fn(activation): |