class_docstr: Wrapper class for calling ngram_repeat_block cuda extension.
docstr: Args:
  hypothesis(Tensor): (beam*bsz, current_sequence_length)
  context(Tensor): context for context-blocking
  lprobs(Tensor): likelihood probability(beam, vocab_size)
  bsz(int): batch size
  step(int): current step
  beam_size(int): beam size
  no_repeat_ngram_size(int): Ngram size
  if_context_blocking(bool): whether to use context-blocking
docstr_tok: ["Args",":","hypothesis","(","Tensor",")",":","(","beam","*","bsz",",","current_sequence_length",")","context","(","Tensor",")",":","context","for","context-blocking","lprobs","(","Tensor",")",":","likelihood","probability","(","beam",",","vocab_size",")","bsz","(","int",")",":","batch","size","step","(","int",")",":","current","step","beam_size","(","int",")",":","beam","size","no_repeat_ngram_size","(","int",")",":","Ngram","size","if_context_blocking","(","bool",")",":","whether","to","use","context-blocking"]
code: def forward(
      self,
      hypothesis,
      context,
      lprobs,
      bsz,
      step,
      beam_size,
      no_repeat_ngram_size,
      if_context_blocking=False,
  ):
      """
      Args:
      hypothesis(Tensor): (beam*bsz, current_sequence_length)
      context(Tensor): context for context-blocking
      lprobs(Tensor): likelihood probability(beam, vocab_size)
      bsz(int): batch size
      step(int): current step
      beam_size(int): beam size
      no_repeat_ngram_size(int): Ngram size
      if_context_blocking(bool): whether to use context-blocking
      """
      # placeholder tensor to pass in to pass type check, won't be used
      if not if_context_blocking:
          context = torch.Tensor([0]).long()
      assert hypothesis.size(0) == bsz * beam_size
      assert lprobs.size(0) == bsz * beam_size
      hypothesis = hypothesis.contiguous()
      context = context.contiguous()
      lprobs = lprobs.contiguous()
      return self.ngram_repeat_block_cuda.forward(
          hypothesis,
          context,
          lprobs,
          bsz,
          step,
          beam_size,
          no_repeat_ngram_size,
          if_context_blocking,
      )
  
file_path: ParlAI/parlai/ops/ngram_repeat_block.py
imports: import parlai.utils.logging
  import torch
  from torch import nn
  import os
  from torch.utils.cpp_extension import load
label_desc: Use image node_id 2 for calling the NGramRepeatBlock obj's underlying member method code with example usage: obj.forward(hypothesis, context, lprobs, bsz, step, beam_size, no_repeat_ngram_size, if_context_blocking) and returns: self