(self, configs)
| 12 | Vanilla Transformer with O(L^2) complexity |
| 13 | """ |
| 14 | def __init__(self, configs): |
| 15 | super(Model, self).__init__() |
| 16 | self.pred_len = configs.pred_len |
| 17 | self.output_attention = configs.output_attention |
| 18 | |
| 19 | # Embedding |
| 20 | if configs.embed_type == 0: |
| 21 | self.enc_embedding = DataEmbedding(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 22 | configs.dropout) |
| 23 | self.dec_embedding = DataEmbedding(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 24 | configs.dropout) |
| 25 | elif configs.embed_type == 1: |
| 26 | self.enc_embedding = DataEmbedding(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 27 | configs.dropout) |
| 28 | self.dec_embedding = DataEmbedding(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 29 | configs.dropout) |
| 30 | elif configs.embed_type == 2: |
| 31 | self.enc_embedding = DataEmbedding_wo_pos(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 32 | configs.dropout) |
| 33 | self.dec_embedding = DataEmbedding_wo_pos(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 34 | configs.dropout) |
| 35 | |
| 36 | elif configs.embed_type == 3: |
| 37 | self.enc_embedding = DataEmbedding_wo_temp(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 38 | configs.dropout) |
| 39 | self.dec_embedding = DataEmbedding_wo_temp(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 40 | configs.dropout) |
| 41 | elif configs.embed_type == 4: |
| 42 | self.enc_embedding = DataEmbedding_wo_pos_temp(configs.enc_in, configs.d_model, configs.embed, configs.freq, |
| 43 | configs.dropout) |
| 44 | self.dec_embedding = DataEmbedding_wo_pos_temp(configs.dec_in, configs.d_model, configs.embed, configs.freq, |
| 45 | configs.dropout) |
| 46 | # Encoder |
| 47 | self.encoder = Encoder( |
| 48 | [ |
| 49 | EncoderLayer( |
| 50 | AttentionLayer( |
| 51 | FullAttention(False, configs.factor, attention_dropout=configs.dropout, |
| 52 | output_attention=configs.output_attention), configs.d_model, configs.n_heads), |
| 53 | configs.d_model, |
| 54 | configs.d_ff, |
| 55 | dropout=configs.dropout, |
| 56 | activation=configs.activation |
| 57 | ) for l in range(configs.e_layers) |
| 58 | ], |
| 59 | norm_layer=torch.nn.LayerNorm(configs.d_model) |
| 60 | ) |
| 61 | # Decoder |
| 62 | self.decoder = Decoder( |
| 63 | [ |
| 64 | DecoderLayer( |
| 65 | AttentionLayer( |
| 66 | FullAttention(True, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 67 | configs.d_model, configs.n_heads), |
| 68 | AttentionLayer( |
| 69 | FullAttention(False, configs.factor, attention_dropout=configs.dropout, output_attention=False), |
| 70 | configs.d_model, configs.n_heads), |
| 71 | configs.d_model, |
nothing calls this directly
no test coverage detected