1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-12 15:26:54 +08:00

Fix TCN model input dimension mismatch (#1520)

* transpose dimension 1 and 2 to match nn.Conv1d input

* 1.update TCN benchmarks;
2.Emphasize updating the benchmark table;

* replace specific version with main

---------

Co-authored-by: lijinhui <362237642@qq.com>
This commit is contained in:
Fivele-Li
2023-05-26 14:44:34 +08:00
committed by GitHub
parent 370477288d
commit 19a0eb78bc
2 changed files with 6 additions and 5 deletions

View File

@@ -168,7 +168,8 @@ class TCN(Model):
self.TCN_model.train()
for data in data_loader:
feature = data[:, :, 0:-1].to(self.device)
data = torch.transpose(data, 1, 2)
feature = data[:, 0:-1, :].to(self.device)
label = data[:, -1, -1].to(self.device)
pred = self.TCN_model(feature.float())
@@ -187,8 +188,8 @@ class TCN(Model):
losses = []
for data in data_loader:
feature = data[:, :, 0:-1].to(self.device)
data = torch.transpose(data, 1, 2)
feature = data[:, 0:-1, :].to(self.device)
# feature[torch.isnan(feature)] = 0
label = data[:, -1, -1].to(self.device)