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

推理时 解析model output变量 #142

Open
stjack01 opened this issue Sep 9, 2024 · 3 comments
Open

推理时 解析model output变量 #142

stjack01 opened this issue Sep 9, 2024 · 3 comments

Comments

@stjack01
Copy link

stjack01 commented Sep 9, 2024

Hi @kwuking

你好,我希望在推理中解析出Target变量的值,从下面的代码,我理解的model的output的维度是[batch, pred_len+label_len, variables]. 就是第3个维度是模型的全部变量(X,Y)的维度。 但是我实际打印output的维度时发现,outputs.shape= [24,1280,1], 似乎模型每次输出的output只包含一个变量的结果?

features =M

如果training和infer的时候使用features=M, 我需要自己判断outputs的第三个维度具体对应哪个变量? 不知道我的理解对吗?

        if args.output_attention:
                outputs = model(batch_x, batch_x_mark, dec_inp, batch_y_mark)[0]
            else:
                outputs = model(batch_x, batch_x_mark, dec_inp, batch_y_mark)

            **f_dim = -1 if args.features == 'MS' else 0**
            outputs = outputs[:, -args.pred_len:, f_dim:]
            batch_y = batch_y[:, -args.pred_len:, f_dim:]
            loss = criterion(outputs, batch_y)
            train_loss.append(loss.item())

我同时检查了batch_x, batch_x_mark,batch_y_mark 这3个变量的输入维度,发现都是[24,96,1] , 似乎是因为data_loader.py的如下代码? 每次get_item只返回一个变量 (feat_id = 变量的序号)?

    seq_x = self.data_x[s_begin:s_end, feat_id:feat_id + 1]
    seq_y = self.data_y[r_begin:r_end, feat_id:feat_id + 1]
    seq_x_mark = self.data_stamp[s_begin:s_end]
    seq_y_mark = self.data_stamp[r_begin:r_end]

我的问题是,outputs = model(batch_x, batch_x_mark, dec_inp, batch_y_mark) 可以实现同时输入全部变量吗? 假设有10个var, 预测长度=32,需要怎么做才能得到 10*32 的output?我应该怎么解析出Target变量的输出呢? 非常感谢

modelparams

@USTCdyf
Copy link

USTCdyf commented Sep 27, 2024

请问你解决了吗

@stjack01
Copy link
Author

stjack01 commented Oct 6, 2024

@USTCdyf , not yet

@Dinosaur-159
Copy link

Dinosaur-159 commented Oct 30, 2024

I alse meet this problem,everything refers to that “features” is “S”. No matter what the "features" is ?

Renewal

In my test,feat_id will change. Different features are used, but only one.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants