""" Dual-Modal Fusion: DMMV-A + DMMV-S (without Kronos). Combines advantages of adaptive decomposition and moving average decomposition. """ import torch import torch.nn as nn import sys sys.path.insert(0, '/workspace/dmmv') from model_dmmv_a import DMMV_A_Wrapper from model_dmmv_s import DMMV_S_Fixed class DMMV_AS_Fusion(nn.Module): """Dual-Modal DMMV Fusion (without Kronos).""" def __init__(self, configs): super().__init__() # DMMV-A Branch: Adaptive Decomposition self.dmmv_a = DMMV_A_Wrapper(configs) # DMMV-S Branch: Moving Average Decomposition self.dmmv_s = DMMV_S_Fixed(configs) # Simple weighted fusion self.alpha = nn.Parameter(torch.tensor(0.5)) # Learnable weight def forward(self, x): # Predictions from both DMMV branches pred_a = self.dmmv_a(x) # [B, PredLen, C] pred_s = self.dmmv_s(x) # [B, PredLen, C] # Weighted fusion w = torch.sigmoid(self.alpha) # Range 0-1 fused = w * pred_a + (1 - w) * pred_s return fused