code: def wrap_collate_with_empty(
      *,
      collate_fn: Optional[_collate_fn_t],
      sample_empty_shapes: Sequence[Tuple],
      dtypes: Sequence[Union[torch.dtype, Type]],
  ):
      """
      Wraps given collate function to handle empty batches.
  
      Args:
          collate_fn: collate function to wrap
          sample_empty_shapes: expected shape for a batch of size 0. Input is a sequence -
              one for each tensor in the dataset
  
      Returns:
          New collate function, which is equivalent to input ``collate_fn`` for non-empty
          batches and outputs empty tensors with shapes from ``sample_empty_shapes`` if
          the input batch is of size 0
      """
  
      return partial(
          collate,
          collate_fn=collate_fn,
          sample_empty_shapes=sample_empty_shapes,
          dtypes=dtypes,
      )
  
file_path: opacus/opacus/data_loader.py
imports: import logging
  from functools import partial
  from typing import Any, List, Optional, Sequence, Tuple, Type, Union
  import torch
  from opacus.utils.uniform_sampler import DistributedUniformWithReplacementSampler, UniformWithReplacementSampler
  from torch.utils.data import BatchSampler, DataLoader, Dataset, IterableDataset, Sampler
  from torch.utils.data._utils.collate import default_collate
  from torch.utils.data.dataloader import _collate_fn_t
label_desc: Use image node_id 2 for calling a global function with example usage: wrap_collate_with_empty() and returns: partial