(self, configs)
| 35 | Informer with Propspare attention in O(LlogL) complexity |
| 36 | """ |
| 37 | def __init__(self, configs): |
| 38 | super(Model, self).__init__() |
| 39 | self.pred_len = configs.pred_len |
| 40 | self.output_attention = configs.output_attention |
| 41 | |
| 42 | self.prob_forecasting = configs.prob_forecasting |
| 43 | c_out = configs.c_out*2 if self.prob_forecasting else configs.c_out |
| 44 | |
| 45 | # Embedding |
| 46 | self.enc_embedding = DataEmbedding(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 47 | configs.dropout) |
| 48 | self.dec_embedding = DataEmbedding(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 49 | configs.dropout) |
| 50 | |
| 51 | # Encoder |
| 52 | self.encoder = Encoder( |
| 53 | [ |
| 54 | EncoderLayer( |
| 55 | AttentionLayer( |
| 56 | ProbAttention(False, configs.factor, attention_dropout=configs.dropout, |
| 57 | output_attention=configs.output_attention), |
| 58 | configs.d_model, configs.n_heads), |
| 59 | configs.d_model, |
| 60 | configs.d_ff, |
| 61 | dropout=configs.dropout, |
| 62 | activation=configs.activation |
| 63 | ) for l in range(configs.e_layers) |
| 64 | ], |
| 65 | [ |
| 66 | ConvLayer( |
| 67 | configs.d_model |
| 68 | ) for l in range(configs.e_layers - 1) |
| 69 | ] if configs.distil else None, |
| 70 | norm_layer=torch.nn.LayerNorm(configs.d_model) |
| 71 | ) |
| 72 | # Decoder |
| 73 | self.decoder = Decoder( |
| 74 | [ |
| 75 | DecoderLayer( |
| 76 | AttentionLayer( |
| 77 | ProbAttention(True, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 78 | configs.d_model, configs.n_heads), |
| 79 | AttentionLayer( |
| 80 | ProbAttention(False, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 81 | configs.d_model, configs.n_heads), |
| 82 | configs.d_model, |
| 83 | configs.d_ff, |
| 84 | dropout=configs.dropout, |
| 85 | activation=configs.activation, |
| 86 | ) |
| 87 | for l in range(configs.d_layers) |
| 88 | ], |
| 89 | norm_layer=torch.nn.LayerNorm(configs.d_model), |
| 90 | projection=nn.Linear(configs.d_model, c_out, bias=True) |
| 91 | ) |
| 92 | |
| 93 | def forward(self, x_enc, x_mark_enc, x_dec, x_mark_dec, |
| 94 | enc_self_mask=None, dec_self_mask=None, dec_enc_mask=None): |
nothing calls this directly
no test coverage detected