class_docstr: A smoothed approximation of a uniform prior.
  
  Has full support on the reals and is differentiable everywhere.
  
  .. math::
  
      \begin{equation*}
          B = {x: a_i <= x_i <= b_i}
          d(x, B) = min_{x' in B} |x - x'|
          pdf(x) \sim exp(- d(x, B)**2 / sqrt(2 * sigma^2))
      \end{equation*}
class_docstr_tok: ["A","smoothed","approximation","of","a","uniform","prior",".","Has","full","support","on","the","reals","and","is","differentiable","everywhere",".","..","math",":",":","\\begin","{","equation","*","}","B","=","{","x",":","a_i","<","=","x_i","<","=","b_i","}","d","(","x",",","B",")","=","min_","{","x","'","in","B","}","|x","-","x'|","pdf","(","x",")","\\sim","exp","(","-","d","(","x",",","B",")","*","*","2","\/","sqrt","(","2","*","sigma^2",")",")","\\end","{","equation","*","}"]
code: def __init__(
      self, a, b, sigma=0.01, validate_args=False, transform=None
  ):
      TModule.__init__(self)
      _a = torch.tensor(float(a)) if isinstance(a, Number) else a
      _a = _a.view(-1) if _a.dim() < 1 else _a
      _a, _b, _sigma = broadcast_all(_a, b, sigma)
      if not torch.all(constraints.less_than(_b).check(_a)):
          raise ValueError("must have that a < b (element-wise)")
      # TODO: Proper argument validation including broadcasting
      batch_shape, event_shape = _a.shape[:-1], _a.shape[-1:]
      # need to assign values before registering as buffers to make argument validation work
      self.a, self.b, self.sigma = _a, _b, _sigma
      super(SmoothedBoxPrior, self).__init__(
          batch_shape, event_shape, validate_args=validate_args
      )
      # now need to delete to be able to register buffer
      del self.a, self.b, self.sigma
      self.register_buffer("a", _a)
      self.register_buffer("b", _b)
      self.register_buffer("sigma", _sigma.clone())
      self.tails = NormalPrior(
          torch.zeros_like(_a), _sigma, validate_args=validate_args
      )
      self._transform = transform
  
file_path: gpytorch/gpytorch/priors/smoothed_box_prior.py
imports: import math
  from numbers import Number
  import torch
  from torch.distributions import constraints
  from torch.distributions.utils import broadcast_all
  from torch.nn import Module
  from .prior import Prior
  from .torch_priors import NormalPrior
label_desc: Use image node_id 1 to create a new SmoothedBoxPrior object from inherited base classes: Prior with example: obj = SmoothedBoxPrior(a, b, sigma, validate_args, transform)