Multiple Series decomposition block from FEDformer
| 54 | |
| 55 | |
| 56 | class series_decomp_multi(nn.Module): |
| 57 | """ |
| 58 | Multiple Series decomposition block from FEDformer |
| 59 | """ |
| 60 | |
| 61 | def __init__(self, kernel_size): |
| 62 | super(series_decomp_multi, self).__init__() |
| 63 | self.kernel_size = kernel_size |
| 64 | self.series_decomp = [series_decomp(kernel) for kernel in kernel_size] |
| 65 | |
| 66 | def forward(self, x): |
| 67 | moving_mean = [] |
| 68 | res = [] |
| 69 | for func in self.series_decomp: |
| 70 | sea, moving_avg = func(x) |
| 71 | moving_mean.append(moving_avg) |
| 72 | res.append(sea) |
| 73 | |
| 74 | sea = sum(res) / len(res) |
| 75 | moving_mean = sum(moving_mean) / len(moving_mean) |
| 76 | return sea, moving_mean |
| 77 | |
| 78 | |
| 79 | class EncoderLayer(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected