class_docstr: Creates a stochastic depth layer.
class_docstr_tok: ["Creates","a","stochastic","depth","layer","."]
code: def forward(self, input: Tensor) -> Tensor:
      if not self.training or self._drop_rate == 0.0:
          return input
  
      keep_prob = 1.0 - self._drop_rate
      batch_size = input.shape[0]
      random_tensor = keep_prob
      random_tensor = random_tensor + torch.rand(
          [batch_size] + [1] * (input.dim() - 1), dtype=input.dtype
      )
      binary_tensor = torch.floor(random_tensor)
      return input / keep_prob * binary_tensor
  
imports: from typing import Optional, Tuple
  import torch
  import torch.nn
  from torch import Tensor
label_desc: Use image node_id 2 for calling the StochasticDepth obj's underlying member method code with example usage: obj.forward(input) and returns: unknown, input