class_docstr: Context gate is a decoder module that takes as input the previous word
  embedding, the current decoder state and the attention state, and
  produces a gate.
  The gate can be used to select the input from the target side context
  (decoder state), from the source context (attention state) or both.
class_docstr_tok: ["Context","gate","is","a","decoder","module","that","takes","as","input","the","previous","word","embedding",",","the","current","decoder","state","and","the","attention","state",",","and","produces","a","gate",".","The","gate","can","be","used","to","select","the","input","from","the","target","side","context","(","decoder","state",")",",","from","the","source","context","(","attention","state",")","or","both","."]
code: def __init__(
      self, embeddings_size, decoder_size, attention_size, output_size
  ):
      super(ContextGate, self).__init__()
      input_size = embeddings_size + decoder_size + attention_size
      self.gate = nn.Linear(input_size, output_size, bias=True)
      self.sig = nn.Sigmoid()
      self.source_proj = nn.Linear(attention_size, output_size)
      self.target_proj = nn.Linear(
          embeddings_size + decoder_size, output_size
      )
  
file_path: OpenNMT-py/onmt/modules/gate.py
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new ContextGate object from inherited base classes: nn with example: obj = ContextGate(embeddings_size, decoder_size, attention_size, output_size)