Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from thuml:main #18

Merged
merged 7 commits into from
Jul 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update MambaSimple.py
  • Loading branch information
wuhaixu2016 authored Jul 14, 2024
commit 58bfec40c7a80d3035969f2297f518236e94e52d
15 changes: 1 addition & 14 deletions models/MambaSimple.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def __init__(self, configs):

self.out_layer = nn.Linear(configs.d_model, configs.c_out, bias=False)

# def short_term_forecast(self, x_enc, x_mark_enc):
def forecast(self, x_enc, x_mark_enc):
mean_enc = x_enc.mean(1, keepdim=True).detach()
x_enc = x_enc - mean_enc
Expand All @@ -47,22 +46,10 @@ def forecast(self, x_enc, x_mark_enc):
x_out = x_out * std_enc + mean_enc
return x_out

# def long_term_forecast(self, x_enc, x_mark_enc):
# x = self.embedding(x_enc, x_mark_enc)
# for layer in self.layers:
# x = layer(x)

# x = self.norm(x)
# x_out = self.out_layer(x)
# return x_out

def forward(self, x_enc, x_mark_enc, x_dec, x_mark_dec, mask=None):
if self.task_name in ['short_term_forecast', 'long_term_forecast']:
x_out = self.forecast(x_enc, x_mark_enc)
return x_out[:, -self.pred_len:, :]


# other tasks not implemented


class ResidualBlock(nn.Module):
Expand Down Expand Up @@ -172,4 +159,4 @@ def __init__(self, d_model, eps=1e-5):

def forward(self, x):
output = x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps) * self.weight
return output
return output