code: def drop_path_func(x, drop_prob: float = 0.0, training: bool = False):
      """
      Stochastic Depth per sample.
      """
      if drop_prob == 0.0 or not training:
          return x
      keep_prob = 1 - drop_prob
      shape = (x.shape[0],) + (1,) * (
          x.ndim - 1
      )  # work with diff dim tensors, not just 2D ConvNets
      mask = keep_prob + torch.rand(
          shape, dtype=x.dtype, device=x.device
      )
      mask.floor_()  # binarize
      output = x.div(keep_prob) * mask
      return output
  
imports: import math
  from functools import partial
  from typing import Tuple, List
  import numpy
  import torch
  from torch import nn
  from torch.nn.init import trunc_normal_
  from einops import rearrange
  from towhee.models.layers.layers_with_relprop import GELU, Linear, Dropout, Conv2d, Conv3d, Softmax, Sigmoid, LayerNorm, Einsum, Add, Clone, MaxPool3d, IndexSelect
label_desc: Use image node_id 6 for calling a global function with example usage: drop_path_func(x, drop_prob, training) and returns: output, x