docstr: If applicable, computes the device's CUDA memory difference between the
  sum of the values in the stats dict and the current allocated CUDA memory.
  
  Args:
      device: torch.device
      stats: dictionary from item names (e.g. input_tensor, module, labels)
      to their respective sizes
  
  Returns:
      device's CUDA memory difference between the sum of the values in the
      stats dict and the current allocated CUDA memory if given a CUDA
      device. 0 if given a CPU device.
code: def _get_memory_difference(
      device: torch.device, stats: Dict[str, int]
  ) -> int:
      """If applicable, computes the device's CUDA memory difference between the
      sum of the values in the stats dict and the current allocated CUDA memory.
  
      Args:
          device: torch.device
          stats: dictionary from item names (e.g. input_tensor, module, labels)
          to their respective sizes
  
      Returns:
          device's CUDA memory difference between the sum of the values in the
          stats dict and the current allocated CUDA memory if given a CUDA
          device. 0 if given a CPU device.
      """
      if device.type == "cuda":
          return torch.cuda.memory_allocated(device) - sum(
              stats.values()
          )
      return 0
  
imports: from enum import Enum
  from typing import Callable, Dict, Optional, Tuple, Type, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from opacus.grad_sample import GradSampleModule
  from opacus.grad_sample.utils import wrap_model
  from opacus.layers import DPGRU, DPLSTM, DPRNN, DPMultiheadAttention
  from opacus.layers.dp_rnn import DPRNNBase
label_desc: Use image node_id 2 for calling the Layer obj's underlying member method code with example usage: obj._get_memory_difference(device, stats) and returns: int, unknown