thuml / Autoformer

About Code release for "Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting" (NeurIPS 2021), https://arxiv.org/abs/2106.13008
MIT License
2k stars 429 forks source link

set --moving_avg 20 cause scripts/Exchange_script/Autoformer.sh: RuntimeError: The size of tensor a (96) must match the size of tensor b (95) at non-singleton dimension 1 #185

Closed mw66 closed 1 year ago

mw66 commented 1 year ago
  File "/Autoformer/layers/Autoformer_EncDec.py", line 49, in forward
    res = x - moving_mean                                                                         
RuntimeError: The size of tensor a (96) must match the size of tensor b (95) at non-singleton dimension 1

set: --moving_avg 30 will cause the same error.

Why it only works for the default value of --moving_avg 25? there must be a bug somewhere.

mw66 commented 1 year ago

the tried command is:

python -u run.py \                                                                                                                                                                                  
  --is_training 1 \                                                                                                                                                                                 
  --root_path ./dataset/exchange_rate/ \                                                                                                                                                            
  --data_path exchange_rate.csv \                                                                                                                                                                   
  --model_id Exchange_96_96 \                                                                                                                                                                       
  --model Autoformer \                                                                                                                                                                              
  --data custom \                                                                                                                                                                                   
  --features M \                                                                                                                                                                                    
  --seq_len 96 \                                                                                                                                                                                    
  --label_len 48 \                                                                                                                                                                                  
  --pred_len 96 \                                                                                                                                                                                   
  --e_layers 2 \                                                                                                                                                                                    
  --d_layers 1 \                                                                                                                                                                                    
  --factor 3 \                                                                                                                                                                                      
  --enc_in 8 \                                                                                                                                                                                      
  --dec_in 8 \                                                                                                                                                                                      
  --c_out 8 \                                                                                                                                                                                       
  --des 'Exp' \                                                                                                                                                                                     
  --moving_avg 30 \                                                                                                                                                                                 
  --itr 1        
wuhaixu2016 commented 1 year ago

Hi, the moving_avg value should be odd. You can try 29 or 31.