class_docstr: STACL: Simultaneous Translation with Implicit Anticipation and
  Controllable Latency using Prefix-to-Prefix Framework
  https://www.aclweb.org/anthology/P19-1289/
class_docstr_tok: ["STACL",":","Simultaneous","Translation","with","Implicit","Anticipation","and","Controllable","Latency","using","Prefix-to-Prefix","Framework","https",":","\/\/www.aclweb.org\/anthology\/P19-1289\/"]
code: def __init__(self, args):
      super().__init__(args)
      self.q_in_proj["soft"] = self.q_in_proj["monotonic"]
      self.k_in_proj["soft"] = self.k_in_proj["monotonic"]
  
      self.waitk_lagging = args.waitk_lagging
      assert (
          self.waitk_lagging > 0
      ), f"Lagging has to been larger than 0, get {self.waitk_lagging}."
  
imports: import math
  import torch
  from torch import Tensor
  import torch.nn
  from examples.simultaneous_translation.utils.p_choose_strategy import learnable_p_choose, waitk_p_choose
  from examples.simultaneous_translation.utils.monotonic_attention import expected_alignment_from_p_choose, expected_soft_attention, mass_preservation
  from fairseq.modules import MultiheadAttention
  from .None import register_monotonic_attention
  from typing import Dict, Optional
label_desc: Use image node_id 1 to create a new WaitKAttention object from inherited base classes: MonotonicInfiniteLookbackAttention with example: obj = WaitKAttention(args)