code: def resize_dataset_to_n_steps(
      dataset: torch.utils.data.Dataset,
      dataset_steps: int,
      samples_per_step: int,
      args: argparse.Namespace,
  ) -> torch.utils.data.Dataset:
      original_size = len(dataset)
      if args.steps_is_epochs:
          samples_per_step = original_size
      target_size = dataset_steps * samples_per_step
  
      dataset_copies = []
      n_expands, remainder = divmod(target_size, original_size)
      for idx in range(n_expands):
          dataset_copies.append(dataset)
  
      if remainder > 0:
          dataset_copies.append(
              torch.utils.data.Subset(dataset, list(range(remainder)))
          )
  
      if args.dataset_shuffle:
          dataset_copies = [
              shuffle_dataset(dataset_copy)
              for dataset_copy in dataset_copies
          ]
  
      dataset = torch.utils.data.ConcatDataset(dataset_copies)
      return dataset
  
imports: import argparse
  import os
  import warnings
  from pathlib import Path
  from typing import List, Union
  import numpy
  import torch
  import torch.distributed
  import torchvision.models.optical_flow
  import torchvision.prototype.models.depth.stereo
  import utils
  import visualization
  from parsing import make_dataset, make_eval_transform, make_train_transform, VALID_DATASETS
  from torch import nn
  from torchvision.transforms.functional import get_dimensions, InterpolationMode, resize
  from utils.metrics import AVAILABLE_METRICS
  from utils.norm import freeze_batch_norm
label_desc: Use image node_id 4 for calling a global function with example usage: resize_dataset_to_n_steps(dataset, dataset_steps, samples_per_step, args) and returns: dataset