feat: add TimesNet_Q and xPatch models with Q matrix transformations

This commit is contained in:
game-loader
2025-08-06 18:39:26 +08:00
parent 7fdf0f364d
commit 6bba6613c9
14 changed files with 872 additions and 3 deletions

21
layers/decomp.py Normal file
View File

@ -0,0 +1,21 @@
import torch
from torch import nn
from layers.ema import EMA
from layers.dema import DEMA
class DECOMP(nn.Module):
"""
Series decomposition block
"""
def __init__(self, ma_type, alpha, beta):
super(DECOMP, self).__init__()
if ma_type == 'ema':
self.ma = EMA(alpha)
elif ma_type == 'dema':
self.ma = DEMA(alpha, beta)
def forward(self, x):
moving_average = self.ma(x)
res = x - moving_average
return res, moving_average