code: def dropout(
      x: torch.Tensor,
      p: float,
      bias: Optional[torch.Tensor] = None,
      activation: Optional[Activation] = None,
  ):
      """
      Apply dropout on the input tensor.
      Optionally add a bias, the computation will be fused.
      """
  
      assert p <= 1.0 and p >= 0.0
  
      if p == 1.0:
          return torch.zeros_like(x)
  
      # Micro optim, skip dropout
      if p == 0.0:
          x = x + bias if bias is not None else x
          if activation is not None:
              activation_fn = build_activation(activation)
              return activation_fn(x)
          return x
  
      # The normal triton enabled codepath
      activation_index = get_triton_activation_index(activation)
      return _dropout.apply(
          x,
          float(p),
          bias,
          activation_index,
          bias is not None and bias.requires_grad,
      )
  
file_path: xformers/xformers/triton/dropout.py
imports: from typing import Optional
  import torch
  import triton
  from torch.cuda.amp import custom_bwd, custom_fwd
  from xformers.components.activations import Activation, build_activation
  from xformers.triton.k_activations import get_triton_activation_index
  from xformers.triton.k_dropout import k_dropout_bw, k_dropout_fw
label_desc: Use image node_id 1 for calling a global function with example usage: dropout(x, p, bias, activation) and returns: _dropout, torch, x, activation_fn