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 forward(self, x: torch.Tensor) -> torch.Tensor:
      # Convenience, catch a possible type or device mismatch
      if self.bias is not None:
          self.bias = self.bias.to(dtype=x.dtype, device=x.device)  # type: ignore
  
      # Train/inference
      p = self.p if self.training else 0.0
  
      # This kernel is slower than pytorch for small buffers, bypassing it in that case
      perf_check = x.shape[-1] > 512
  
      # Catch a non-cuda setup, fallback to pytorch
      if not x.is_cuda or not perf_check or p == 0.0:
          x = x + self.bias if self.bias is not None else x
          x = self.activation_pytorch(x)
          return torch.nn.functional.dropout(x, p) if p > 0.0 else x
  
      # The normal, Triton-backed path
      return _dropout.apply(x, p, self.bias, self.activation, True)
  
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 3 for calling the FusedDropoutBias obj's underlying member method code with example usage: obj.forward(x) and returns: _dropout, unknown