code: def _compute_aspect_ratios_slow(dataset, indices=None):
      print(
          "Your dataset doesn't support the fast path for "
          "computing the aspect ratios, so will iterate over "
          "the full dataset and load every image instead. "
          "This might take some time..."
      )
      if indices is None:
          indices = range(len(dataset))
  
      class SubsetSampler(Sampler):
          def __init__(self, indices):
              self.indices = indices
  
          def __iter__(self):
              return iter(self.indices)
  
          def __len__(self):
              return len(self.indices)
  
      sampler = SubsetSampler(indices)
      data_loader = torch.utils.data.DataLoader(
          dataset,
          batch_size=1,
          sampler=sampler,
          num_workers=14,  # you might want to increase it for faster processing
          collate_fn=lambda x: x[0],
      )
      aspect_ratios = []
      with tqdm(total=len(dataset)) as pbar:
          for _i, (img, _) in enumerate(data_loader):
              pbar.update(1)
              height, width = img.shape[-2:]
              aspect_ratio = float(width) / float(height)
              aspect_ratios.append(aspect_ratio)
      return aspect_ratios
  
imports: import bisect
  import copy
  import math
  from collections import defaultdict
  from itertools import repeat, chain
  import numpy
  import torch
  import torch.utils.data
  import torchvision
  from PIL import Image
  from torch.utils.data.sampler import BatchSampler, Sampler
  from torch.utils.model_zoo import tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: _compute_aspect_ratios_slow(dataset, indices) and returns: aspect_ratios, iter, len