Skip to content

Commit

Permalink
fix(torch): csvts forecast mode needs sequence of length backcast dur…
Browse files Browse the repository at this point in the history
…ing predict
  • Loading branch information
Bycob authored and mergify[bot] committed Jan 21, 2021
1 parent 5a5c8f1 commit 4c89a1c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/backends/torch/torchinputconns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,20 +848,21 @@ namespace dd
{
vecindex++;
long int tstart = 0;
if (static_cast<long int>(seq.size())
< _backcast_timesteps + _forecast_timesteps)
long int timesteps = _train ? _backcast_timesteps + _forecast_timesteps
: _backcast_timesteps;
if (static_cast<long int>(seq.size()) < timesteps)
{
discard_warn(vecindex, seq.size(), test);
continue;
}
for (; tstart + _backcast_timesteps + _forecast_timesteps
< static_cast<long int>(seq.size());
for (; tstart + timesteps < static_cast<long int>(seq.size());
tstart += _offset)
add_data_instance_forecast(tstart, vecindex, dataset, seq);
{
add_data_instance_forecast(tstart, vecindex, dataset, seq);
}
if (tstart < static_cast<long int>(seq.size()) - 1)
add_data_instance_forecast(seq.size() - _backcast_timesteps
- _forecast_timesteps,
vecindex, dataset, seq);
add_data_instance_forecast(seq.size() - timesteps, vecindex, dataset,
seq);
}
}

Expand Down

0 comments on commit 4c89a1c

Please sign in to comment.