class_docstr: ## Attention with Linear Biases (ALiBi)
  
  We override [Multi-Head Attention](../mha.html).
class_docstr_tok: ["#","#","Attention","with","Linear","Biases","(","ALiBi",")","We","override","[","Multi-Head","Attention","]","(","..","\/mha.html",")","."]
code: def __init__(
      self, heads: int, d_model: int, dropout_prob: float = 0.1
  ):
      super().__init__(heads, d_model, dropout_prob)
  
      # To cache AliBi the biases
      self.alibi_biases = None
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/transformers/alibi/__init__.py
imports: import math
  from typing import Optional
  import torch
  from torch import nn
  from labml.logger import inspect
  from labml_nn.transformers.mha import MultiHeadAttention
label_desc: Use image node_id 1 to create a new AlibiMultiHeadAttention object from inherited base classes: MultiHeadAttention with example: obj = AlibiMultiHeadAttention(heads, d_model, dropout_prob)