class_docstr: Computes a covariance matrix based on the Polynomial kernel
  between inputs :math:`\mathbf{x_1}` and :math:`\mathbf{x_2}`:
  
  .. math::
      \begin{equation*}
          k_\text{Poly}(\mathbf{x_1}, \mathbf{x_2}) = (\mathbf{x_1}^\top
          \mathbf{x_2} + c)^{d}.
      \end{equation*}
  
  where
  
  * :math:`c` is an offset parameter.
  
  Args:
      offset_prior (:class:`gpytorch.priors.Prior`):
          Prior over the offset parameter (default `None`).
      offset_constraint (Constraint, optional):
          Constraint to place on offset parameter. Default: `Positive`.
      active_dims (list):
          List of data dimensions to operate on.
          `len(active_dims)` should equal `num_dimensions`.
class_docstr_tok: ["Computes","a","covariance","matrix","based","on","the","Polynomial","kernel","between","inputs",":","math",":","`","\\mathbf","{","x_1","}","`","and",":","math",":","`","\\mathbf","{","x_2","}","`",":","..","math",":",":","\\begin","{","equation","*","}","k_\\text","{","Poly","}","(","\\mathbf","{","x_1","}",",","\\mathbf","{","x_2","}",")","=","(","\\mathbf","{","x_1","}","^\\top","\\mathbf","{","x_2","}","+","c",")","^","{","d","}",".","\\end","{","equation","*","}","where","*",":","math",":","`","c","`","is","an","offset","parameter",".","Args",":","offset_prior","(",":","class",":","`","gpytorch.priors.Prior","`",")",":","Prior","over","the","offset","parameter","(","default","`","None","`",")",".","offset_constraint","(","Constraint",",","optional",")",":","Constraint","to","place","on","offset","parameter",".","Default",":","`","Positive","`",".","active_dims","(","list",")",":","List","of","data","dimensions","to","operate","on",".","`","len","(","active_dims",")","`","should","equal","`","num_dimensions","`","."]
code: def forward(
      self,
      x1: torch.Tensor,
      x2: torch.Tensor,
      diag: Optional[bool] = False,
      last_dim_is_batch: Optional[bool] = False,
      **params,
  ) -> torch.Tensor:
      offset = self.offset.view(*self.batch_shape, 1, 1)
  
      if last_dim_is_batch:
          x1 = x1.transpose(-1, -2).unsqueeze(-1)
          x2 = x2.transpose(-1, -2).unsqueeze(-1)
  
      if diag:
          return ((x1 * x2).sum(dim=-1) + self.offset).pow(self.power)
  
      if (x1.dim() == 2 and x2.dim() == 2) and offset.dim() == 2:
          return torch.addmm(offset, x1, x2.transpose(-2, -1)).pow(
              self.power
          )
      else:
          return (torch.matmul(x1, x2.transpose(-2, -1)) + offset).pow(
              self.power
          )
  
file_path: gpytorch/gpytorch/kernels/polynomial_kernel.py
imports: from typing import Optional
  import torch
  from ..constraints import Interval, Positive
  from ..priors import Prior
  from .kernel import Kernel
label_desc: Use image node_id 5 for calling the PolynomialKernel obj's underlying member method code with example usage: obj.forward(x1, x2, diag, last_dim_is_batch) and returns: unknown, torch, unknown