code: def check_dataloader_output(
      dataset: TimeSeriesDataSet, out: Dict[str, torch.Tensor]
  ):
      x, y = out
  
      assert isinstance(
          y, tuple
      ), "y output should be tuple of wegith and target"
  
      # check for nans and finite
      for k, v in x.items():
          for vi in to_list(v):
              assert torch.isfinite(
                  vi
              ).all(), f"Values for {k} should be finite"
              assert not torch.isnan(
                  vi
              ).any(), f"Values for {k} should not be nan"
  
      # check weight
      assert y[1] is None or isinstance(
          y[1], torch.Tensor
      ), "weights should be none or tensor"
      if isinstance(y[1], torch.Tensor):
          assert torch.isfinite(
              y[1]
          ).all(), "Values for weight should be finite"
          assert not torch.isnan(
              y[1]
          ).any(), "Values for weight should not be nan"
  
      # check target
      for targeti in to_list(y[0]):
          assert torch.isfinite(
              targeti
          ).all(), "Values for target should be finite"
          assert not torch.isnan(
              targeti
          ).any(), "Values for target should not be nan"
  
      # check shape
      assert x["encoder_cont"].size(2) == len(dataset.reals)
      assert x["encoder_cat"].size(2) == len(dataset.flat_categoricals)
  
imports: from copy import deepcopy
  import itertools
  import pickle
  from typing import Dict
  import networkx
  import numpy
  import pandas
  import pytest
  from sklearn.preprocessing import StandardScaler
  import torch
  from torch.utils.data.sampler import SequentialSampler
  from pytorch_forecasting.data import EncoderNormalizer, GroupNormalizer, NaNLabelEncoder, TimeSeriesDataSet
  from pytorch_forecasting.data.encoders import MultiNormalizer, TorchNormalizer
  from pytorch_forecasting.data.examples import get_stallion_data
  from pytorch_forecasting.data.timeseries import _find_end_indices
  from pytorch_forecasting.utils import to_list
label_desc: Use image node_id 5 for calling a global function with example usage: check_dataloader_output(dataset, out) without return types