code: def drop_path(x, drop_prob: float = 0.0, training: bool = False):
      """Drop paths (Stochastic Depth) per sample (when applied in main path of
      residual blocks).
      """
      if drop_prob == 0.0 or not training:
          return x
      keep_prob = 1 - drop_prob
      # work with diff dim tensors, not just 2D ConvNets
      shape = (x.shape[0],) + (1,) * (x.ndim - 1)
      random_tensor = keep_prob + torch.rand(
          shape, dtype=x.dtype, device=x.device
      )
      random_tensor.floor_()  # binarize
      output = x.div(keep_prob) * random_tensor
      return output
  
imports: import logging
  import math
  import warnings
  from enum import Enum
  from typing import Dict, List, Tuple
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  from torch.nn.modules.utils import _ntuple
  from torch.utils.checkpoint import checkpoint
  from vissl.data.collators.collator_helper import MultiDimensionalTensor
  from vissl.utils.activation_checkpointing import checkpoint_trunk
  from vissl.utils.env import get_machine_local_and_dist_rank
  from vissl.utils.misc import is_apex_available
label_desc: Use image node_id 17 for calling a global function with example usage: drop_path(x, drop_prob, training) and returns: output, x