Update modeling_super_linear.py
Browse files97 unmodified lines9899100101102103104105106107108109110111112113122 unmodified lines2362372382392402412421 unmodified line24424524624724824925097 unmodified linessuper(moving_avg, self).__init__()self.kernel_size = kernel_sizeself.avg = nn.AvgPool1d(kernel_size=kernel_size, stride=stride, padding=0)"""def forward(self, x):# padding on the both ends of time seriesfront = x[:, 0:1, :].repeat(1, (self.kernel_size - 1) // 2, 1)end = x[:, -1:, :].repeat(1, (self.kernel_size - 1) // 2, 1)x = torch.cat([front, x, end], dim=1)x = self.avg(x.permute(0, 2, 1))x = x.permute(0, 2, 1)return x"""def forward(self, x):# x: [Batch, Input length]# padding on the both ends of time series122 unmodified linesdef forward(self, x):# x: [Batch, Input length,Channel]x_shape = x.shapeif x.shape[1] < self.seq_len:#if self.zero_shot_Linear is None:#print(F"new Lookkback : {x.shape[1]}")1 unmodified linex = self.revin_layer(x, 'norm')x = F.linear(x, self.zero_shot_Linear)x = self.revin_layer(x, 'denorm')return xif len(x_shape) == 2:97 unmodified lines9899100101102103104105122 unmodified lines2282292302312322332341 unmodified line23623723823924024124297 unmodified linessuper(moving_avg, self).__init__()self.kernel_size = kernel_sizeself.avg = nn.AvgPool1d(kernel_size=kernel_size, stride=stride, padding=0)def forward(self, x):# x: [Batch, Input length]# padding on the both ends of time series122 unmodified linesdef forward(self, x):# x: [Batch, Input length,Channel]x_shape = x.shape''''if x.shape[1] < self.seq_len:#if self.zero_shot_Linear is None:#print(F"new Lookkback : {x.shape[1]}")1 unmodified linex = self.revin_layer(x, 'norm')x = F.linear(x, self.zero_shot_Linear)x = self.revin_layer(x, 'denorm')return x'''if len(x_shape) == 2:
modeling_super_linear.py+4-12