class_docstr: An implementation of the autoregressive layer with rational spline bijections of
  linear and quadratic order (Durkan et al., 2019; Dolatabadi et al., 2020).
  Rational splines are functions that are comprised of segments that are the ratio
  of two polynomials (see :class:`~pyro.distributions.transforms.Spline`).
  
  The autoregressive layer uses the transformation,
  
      :math:`y_d = g_{\theta_d}(x_d)\ \ \ d=1,2,\ldots,D`
  
  where :math:`\mathbf{x}=(x_1,x_2,\ldots,x_D)` are the inputs,
  :math:`\mathbf{y}=(y_1,y_2,\ldots,y_D)` are the outputs, :math:`g_{\theta_d}` is
  an elementwise rational monotonic spline with parameters :math:`\theta_d`, and
  :math:`\theta=(\theta_1,\theta_2,\ldots,\theta_D)` is the output of an
  autoregressive NN inputting :math:`\mathbf{x}`.
  
  Example usage:
  
  >>> from pyro.nn import AutoRegressiveNN
  >>> input_dim = 10
  >>> count_bins = 8
  >>> base_dist = dist.Normal(torch.zeros(input_dim), torch.ones(input_dim))
  >>> hidden_dims = [input_dim * 10, input_dim * 10]
  >>> param_dims = [count_bins, count_bins, count_bins - 1, count_bins]
  >>> hypernet = AutoRegressiveNN(input_dim, hidden_dims, param_dims=param_dims)
  >>> transform = SplineAutoregressive(input_dim, hypernet, count_bins=count_bins)
  >>> pyro.module("my_transform", transform)  # doctest: +SKIP
  >>> flow_dist = dist.TransformedDistribution(base_dist, [transform])
  >>> flow_dist.sample()  # doctest: +SKIP
  
  :param input_dim: Dimension of the input vector. Despite operating element-wise,
      this is required so we know how many parameters to store.
  :type input_dim: int
  :param autoregressive_nn: an autoregressive neural network whose forward call
      returns tuple of the spline parameters
  :type autoregressive_nn: callable
  :param count_bins: The number of segments comprising the spline.
  :type count_bins: int
  :param bound: The quantity :math:`K` determining the bounding box,
      :math:`[-K,K]\times[-K,K]`, of the spline.
  :type bound: float
  :param order: One of ['linear', 'quadratic'] specifying the order of the spline.
  :type order: string
  
  References:
  
  Conor Durkan, Artur Bekasov, Iain Murray, George Papamakarios. Neural
  Spline Flows. NeurIPS 2019.
  
  Hadi M. Dolatabadi, Sarah Erfani, Christopher Leckie. Invertible Generative
  Modeling using Linear Rational Splines. AISTATS 2020.
class_docstr_tok: ["An","implementation","of","the","autoregressive","layer","with","rational","spline","bijections","of","linear","and","quadratic","order","(","Durkan","et","al.",",","2019",";","Dolatabadi","et","al.",",","2020",")",".","Rational","splines","are","functions","that","are","comprised","of","segments","that","are","the","ratio","of","two","polynomials","(","see",":","class",":","`","~pyro.distributions.transforms.Spline","`",")",".","The","autoregressive","layer","uses","the","transformation",",",":","math",":","`","y_d","=","g_","{","\\theta_d","}","(","x_d",")","\\","\\","\\","d=1,2",",","\\ldots",",","D","`","where",":","math",":","`","\\mathbf","{","x","}","=","(","x_1",",","x_2",",","\\ldots",",","x_D",")","`","are","the","inputs",",",":","math",":","`","\\mathbf","{","y","}","=","(","y_1",",","y_2",",","\\ldots",",","y_D",")","`","are","the","outputs",",",":","math",":","`","g_","{","\\theta_d","}","`","is","an","elementwise","rational","monotonic","spline","with","parameters",":","math",":","`","\\theta_d","`",",","and",":","math",":","`","\\theta=","(","\\theta_1",",","\\theta_2",",","\\ldots",",","\\theta_D",")","`","is","the","output","of","an","autoregressive","NN","inputting",":","math",":","`","\\mathbf","{","x","}","`",".","Example","usage",":",">",">",">","from","pyro.nn","import","AutoRegressiveNN",">",">",">","input_dim","=","10",">",">",">","count_bins","=","8",">",">",">","base_dist","=","dist.Normal","(","torch.zeros","(","input_dim",")",",","torch.ones","(","input_dim",")",")",">",">",">","hidden_dims","=","[","input_dim","*","10",",","input_dim","*","10","]",">",">",">","param_dims","=","[","count_bins",",","count_bins",",","count_bins","-","1",",","count_bins","]",">",">",">","hypernet","=","AutoRegressiveNN","(","input_dim",",","hidden_dims",",","param_dims=param_dims",")",">",">",">","transform","=","SplineAutoregressive","(","input_dim",",","hypernet",",","count_bins=count_bins",")",">",">",">","pyro.module","(","``","my_transform","''",",","transform",")","#","doctest",":","+SKIP",">",">",">","flow_dist","=","dist.TransformedDistribution","(","base_dist",",","[","transform","]",")",">",">",">","flow_dist.sample","(",")","#","doctest",":","+SKIP",":","param","input_dim",":","Dimension","of","the","input","vector",".","Despite","operating","element-wise",",","this","is","required","so","we","know","how","many","parameters","to","store",".",":","type","input_dim",":","int",":","param","autoregressive_nn",":","an","autoregressive","neural","network","whose","forward","call","returns","tuple","of","the","spline","parameters",":","type","autoregressive_nn",":","callable",":","param","count_bins",":","The","number","of","segments","comprising","the","spline",".",":","type","count_bins",":","int",":","param","bound",":","The","quantity",":","math",":","`","K","`","determining","the","bounding","box",",",":","math",":","`","[","-K",",","K","]","\\times","[","-K",",","K","]","`",",","of","the","spline",".",":","type","bound",":","float",":","param","order",":","One","of","[","'linear","'",",","'quadratic","'","]","specifying","the","order","of","the","spline",".",":","type","order",":","string","References",":","Conor","Durkan",",","Artur","Bekasov",",","Iain","Murray",",","George","Papamakarios",".","Neural","Spline","Flows",".","NeurIPS","2019",".","Hadi","M.","Dolatabadi",",","Sarah","Erfani",",","Christopher","Leckie",".","Invertible","Generative","Modeling","using","Linear","Rational","Splines",".","AISTATS","2020","."]
docstr: :param x: the input into the bijection
  :type x: torch.Tensor
  
  Invokes the bijection x=>y; in the prototypical context of a
  :class:`~pyro.distributions.TransformedDistribution` `x` is a sample from
  the base distribution (or the output of a previous transform)
docstr_tok: [":","param","x",":","the","input","into","the","bijection",":","type","x",":","torch.Tensor","Invokes","the","bijection","x=",">","y",";","in","the","prototypical","context","of","a",":","class",":","`","~pyro.distributions.TransformedDistribution","`","`","x","`","is","a","sample","from","the","base","distribution","(","or","the","output","of","a","previous","transform",")"]
code: def _call(self, x):
      """
      :param x: the input into the bijection
      :type x: torch.Tensor
  
      Invokes the bijection x=>y; in the prototypical context of a
      :class:`~pyro.distributions.TransformedDistribution` `x` is a sample from
      the base distribution (or the output of a previous transform)
      """
      spline = self.spline.condition(x)
      y = spline(x)
      self._cache_log_detJ = spline._cache_log_detJ
      return y
  
imports: from functools import partial
  import torch
  from pyro.nn import AutoRegressiveNN, ConditionalAutoRegressiveNN
  from ..None import constraints
  from ..conditional import ConditionalTransformModule
  from ..torch_transform import TransformModule
  from ..util import copy_docs_from
  from .spline import ConditionalSpline
label_desc: Use image node_id 2 for calling the SplineAutoregressive obj's underlying member method code with example usage: obj._call(x) and returns: y