class_docstr: Returns the Length and Coverage Penalty function for Beam Search.
  
  Args:
      length_pen (str): option name of length pen
      cov_pen (str): option name of cov pen
  
  Attributes:
      has_cov_pen (bool): Whether coverage penalty is None (applying it
          is a no-op). Note that the converse isn't true. Setting beta
          to 0 should force coverage length to be a no-op.
      has_len_pen (bool): Whether length penalty is None (applying it
          is a no-op). Note that the converse isn't true. Setting alpha
          to 1 should force length penalty to be a no-op.
      coverage_penalty (callable[[FloatTensor, float], FloatTensor]):
          Calculates the coverage penalty.
      length_penalty (callable[[int, float], float]): Calculates
          the length penalty.
class_docstr_tok: ["Returns","the","Length","and","Coverage","Penalty","function","for","Beam","Search",".","Args",":","length_pen","(","str",")",":","option","name","of","length","pen","cov_pen","(","str",")",":","option","name","of","cov","pen","Attributes",":","has_cov_pen","(","bool",")",":","Whether","coverage","penalty","is","None","(","applying","it","is","a","no-op",")",".","Note","that","the","converse","is","n't","true",".","Setting","beta","to","0","should","force","coverage","length","to","be","a","no-op",".","has_len_pen","(","bool",")",":","Whether","length","penalty","is","None","(","applying","it","is","a","no-op",")",".","Note","that","the","converse","is","n't","true",".","Setting","alpha","to","1","should","force","length","penalty","to","be","a","no-op",".","coverage_penalty","(","callable","[","[","FloatTensor",",","float","]",",","FloatTensor","]",")",":","Calculates","the","coverage","penalty",".","length_penalty","(","callable","[","[","int",",","float","]",",","float","]",")",":","Calculates","the","length","penalty","."]
docstr: Our summary penalty.
docstr_tok: ["Our","summary","penalty","."]
code: def coverage_summary(self, cov, beta=0.0):
      """Our summary penalty."""
      penalty = torch.max(cov, cov.clone().fill_(1.0)).sum(-1)
      penalty -= cov.size(-1)
      return beta * penalty
  
file_path: OpenNMT-py/onmt/translate/penalties.py
imports: import torch
label_desc: Use image node_id 6 for calling the PenaltyBuilder obj's underlying member method code with example usage: obj.coverage_summary(cov, beta) and returns: unknown