code: def test_tsdataset_to_torch_loader_roll(self):
      df_single_id = get_ts_df()
      df_multi_id = get_multi_id_ts_df()
      for df in [df_single_id, df_multi_id]:
          horizon = random.randint(1, 10)
          lookback = random.randint(1, 20)
          batch_size = random.randint(16, 32)
  
          tsdata = TSDataset.from_pandas(
              df,
              dt_col="datetime",
              target_col="value",
              extra_feature_col=["extra feature"],
              id_col="id",
          )
  
          # train
          torch_loader = tsdata.to_torch_data_loader(
              batch_size=batch_size,
              roll=True,
              lookback=lookback,
              horizon=horizon,
          )
          for x_batch, y_batch in torch_loader:
              assert tuple(x_batch.size()) == (batch_size, lookback, 2)
              assert tuple(y_batch.size()) == (batch_size, horizon, 1)
              break
  
          # test
          torch_loader = tsdata.to_torch_data_loader(
              batch_size=batch_size,
              roll=True,
              lookback=lookback,
              horizon=0,
          )
          for x_batch in torch_loader:
              assert tuple(x_batch.size()) == (batch_size, lookback, 2)
              break
  
          # specify feature_col
          torch_loader = tsdata.to_torch_data_loader(
              batch_size=batch_size,
              roll=True,
              lookback=lookback,
              horizon=horizon,
              feature_col=[],
          )
          for x_batch, y_batch in torch_loader:
              assert tuple(x_batch.size()) == (batch_size, lookback, 1)
              assert tuple(y_batch.size()) == (batch_size, horizon, 1)
              break
  
          # Non-subset relationship
          with pytest.raises(ValueError):
              tsdata.to_torch_data_loader(
                  batch_size=batch_size,
                  roll=True,
                  lookback=lookback,
                  horizon=horizon,
                  target_col=["value", "extra feature"],
              )
  
          # specify horizon_list
          horizon_list = [1, 3, 5]
          torch_loader = tsdata.to_torch_data_loader(
              batch_size=batch_size,
              roll=True,
              lookback=lookback,
              horizon=horizon_list,
          )
          for x_batch, y_batch in torch_loader:
              assert tuple(x_batch.size()) == (batch_size, lookback, 2)
              assert tuple(y_batch.size()) == (
                  batch_size,
                  len(horizon_list),
                  1,
              )
              break
  
          # multi target_col
          tsdata = TSDataset.from_pandas(
              df,
              dt_col="datetime",
              target_col=["value", "extra feature"],
              id_col="id",
          )
          torch_loader = tsdata.to_torch_data_loader(
              batch_size=batch_size,
              roll=True,
              lookback=lookback,
              horizon=horizon,
          )
          for x_batch, y_batch in torch_loader:
              assert tuple(x_batch.size()) == (batch_size, lookback, 2)
              assert tuple(y_batch.size()) == (batch_size, horizon, 2)
              break
  
imports: import pytest
  import numpy
  import pandas
  import random
  import tempfile
  import os
  import shutil
  from test.zoo.pipeline.utils.test_utils import ZooTestCase
  from zoo.chronos.data import TSDataset
  from pandas.testing import assert_frame_equal
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 10 for calling the TestTSDataset obj's underlying member method code with example usage: obj.test_tsdataset_to_torch_loader_roll() without return types