class_docstr: A (non-zero) constant prior mean function, i.e.:
  
  .. math::
      \mu(\mathbf x) = C
  
  where :math:`C` is a learned constant.
  
  :param constant_prior: Prior for constant parameter :math:`C`.
  :type constant_prior: ~gpytorch.priors.Prior, optional
  :param constant_constraint: Constraint for constant parameter :math:`C`.
  :type constant_constraint: ~gpytorch.priors.Interval, optional
  :param batch_shape: The batch shape of the learned constant(s) (default: []).
  :type batch_shape: torch.Size, optional
  
  :var torch.Tensor constant: :math:`C` parameter
class_docstr_tok: ["A","(","non-zero",")","constant","prior","mean","function",",","i.e",".",":","..","math",":",":","\\mu","(","\\mathbf","x",")","=","C","where",":","math",":","`","C","`","is","a","learned","constant",".",":","param","constant_prior",":","Prior","for","constant","parameter",":","math",":","`","C","`",".",":","type","constant_prior",":","~gpytorch.priors.Prior",",","optional",":","param","constant_constraint",":","Constraint","for","constant","parameter",":","math",":","`","C","`",".",":","type","constant_constraint",":","~gpytorch.priors.Interval",",","optional",":","param","batch_shape",":","The","batch","shape","of","the","learned","constant","(","s",")","(","default",":","[","]",")",".",":","type","batch_shape",":","torch.Size",",","optional",":","var","torch.Tensor","constant",":",":","math",":","`","C","`","parameter"]
code: def __init__(
      self,
      constant_prior: Optional[Prior] = None,
      constant_constraint: Optional[Interval] = None,
      batch_shape: torch.Size = torch.Size(),
      **kwargs: Any,
  ):
      super(ConstantMean, self).__init__()
  
      # Deprecated kwarg
      constant_prior_deprecated = kwargs.get("prior")
      if constant_prior_deprecated is not None:
          if (
              constant_prior is None
          ):  # Using the old kwarg for the constant_prior
              warnings.warn(
                  "The kwarg `prior` for ConstantMean has been renamed to `constant_prior`, and will be deprecated.",
                  DeprecationWarning,
              )
              constant_prior = constant_prior_deprecated
          else:  # Weird edge case where someone set both `prior` and `constant_prior`
              warnings.warn(
                  "You have set both the `constant_prior` and the deprecated `prior` arguments for ConstantMean. "
                  "`prior` is deprecated, and will be ignored.",
                  DeprecationWarning,
              )
  
      # Ensure that old versions of the model still load
      self._register_load_state_dict_pre_hook(
          _ensure_updated_strategy_flag_set
      )
  
      self.batch_shape = batch_shape
      self.register_parameter(
          name="raw_constant",
          parameter=torch.nn.Parameter(torch.zeros(batch_shape)),
      )
      if constant_prior is not None:
          self.register_prior(
              "mean_prior",
              constant_prior,
              self._constant_param,
              self._constant_closure,
          )
      if constant_constraint is not None:
          self.register_constraint("raw_constant", constant_constraint)
  
file_path: gpytorch/gpytorch/means/constant_mean.py
imports: import warnings
  from typing import Any, Optional
  import torch
  from ..constraints import Interval
  from ..priors import Prior
  from ..utils.warnings import OldVersionWarning
  from .mean import Mean
label_desc: Use image node_id 1 to create a new ConstantMean object from inherited base classes: Mean with example: obj = ConstantMean(constant_prior, constant_constraint, batch_shape)