Official implementation of our ICLR 2023 paper "Crossformer: Transformer Utilizing Cross-Dimension Dependency for Multivariate Time Series Forecasting"
seg_to_merge = []
for i in range(self.win_size):
seg_to_merge.append(x[:, :, i::self.win_size, :])
x = torch.cat(seg_to_merge, -1) # [B, ts_d, seg_num/win_size, win_size*d_model]
code in cross_encoder.py
seg_to_merge = [] for i in range(self.win_size): seg_to_merge.append(x[:, :, i::self.win_size, :]) x = torch.cat(seg_to_merge, -1) # [B, ts_d, seg_num/win_size, win_size*d_model]
x = self.norm(x) x = self.linear_trans(x)
我想了解一下x为什么要通过seg_to_merge,在seg_num维度变成类似 [0, 2, 4, 1, 3, 5]的排布