class_docstr: A layer which fuses the computation of Dropout(Activation(x))
  in a single GPU kernel
class_docstr_tok: ["A","layer","which","fuses","the","computation","of","Dropout","(","Activation","(","x",")",")","in","a","single","GPU","kernel"]
code: def __init__(
      self,
      p: float,
      bias_shape: Optional[int],
      activation: Optional[Activation] = None,
  ) -> None:
      super().__init__()
  
      self.p = float(p)
  
      assert (
          self.p < 1.0
      ), f"We don't want to drop all the values, most probably p={p} is not properly set"
  
      self.activation_type = activation
      self.bias = (
          torch.zeros(bias_shape, requires_grad=True)
          if bias_shape is not None
          else None
      )
  
      self.activation = get_triton_activation_index(
          self.activation_type
      )
      self.activation_pytorch = build_activation(self.activation_type)
  
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 to create a new FusedDropoutBias object from inherited base classes: torch.nn with example: obj = FusedDropoutBias(p, bias_shape, activation)