timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.14k stars 643 forks source link

TSSequencer with unexpected output #844

Open siwoonlee opened 1 year ago

siwoonlee commented 1 year ago

Hey guys! I may have found something wrong with TSSequencer implementation.

The model seems to have different output values for the same input values. It seems to have some kind of relation between the batch axis of the data. I have example code for this problem.

import torch
import torch.nn as nn
from tsai.models.all import TSSequencerPlus

model = TSSequencerPlus(c_in=4, c_out=3, seq_len=6)
x = torch.rand(4,6)
x2 = torch.stack([x,x])
print(x2)
print(model(x2))

tensor([[[0.9478, 0.4636, 0.1802, 0.4781, 0.2572, 0.5905], [0.8031, 0.4141, 0.4069, 0.5013, 0.9603, 0.7558], [0.6154, 0.1165, 0.7163, 0.4840, 0.1239, 0.5932], [0.6863, 0.4535, 0.4281, 0.5023, 0.4002, 0.1363]], [[0.9478, 0.4636, 0.1802, 0.4781, 0.2572, 0.5905], [0.8031, 0.4141, 0.4069, 0.5013, 0.9603, 0.7558], [0.6154, 0.1165, 0.7163, 0.4840, 0.1239, 0.5932], [0.6863, 0.4535, 0.4281, 0.5023, 0.4002, 0.1363]]]) tensor([[0.1223, 0.7563, 0.2910], [0.1350, 0.7440, 0.2664]], grad_fn=)

i'm using tsai==0.3.6 and torch==2.0.1 thanks!