You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the parameters:
--data ETTh1
--method fsnet
--test_bsz 1
--seq_len 60
--pred_len 1
The training process works fine, but the testing error is as follows:
“RuntimeError: The size of tensor a (7) must match the size of tensor b (343) at non-singleton dimension 1”
Does anyone know how to fix this? Thanks!
The text was updated successfully, but these errors were encountered:
Replace the _ol_one_batch in the exp/exp_fsnet.py with the following one.
def _ol_one_batch(self,dataset_object, batch_x, batch_y, batch_x_mark, batch_y_mark):
batch_y = batch_y.float()
f_dim = -1 if self.args.features=='MS' else 0
batch_y = batch_y[:,-self.args.pred_len:,f_dim:].to(self.device)
true = rearrange(batch_y, 'b t d -> b (t d)').float().to(self.device)
criterion = self._select_criterion()
x = torch.cat([batch_x.float(), batch_x_mark.float()], dim=-1).to(self.device)
for _ in range(self.n_inner):
if self.args.use_amp:
with torch.cuda.amp.autocast():
outputs = self.model(x)
else:
outputs = self.model(x)
# breakpoint()
loss = criterion(outputs, true)
loss.backward()
self.opt.step()
self.model.store_grad()
self.opt.zero_grad()
return outputs, true
I find the issue is related to the test_batchsize. If the test_batchsize equals one, then the original code works well. But if the test_batchsize is larger than one, then the updated code works.
I used the parameters:
--data ETTh1
--method fsnet
--test_bsz 1
--seq_len 60
--pred_len 1
The training process works fine, but the testing error is as follows:
“RuntimeError: The size of tensor a (7) must match the size of tensor b (343) at non-singleton dimension 1”
Does anyone know how to fix this? Thanks!
The text was updated successfully, but these errors were encountered: