class_docstr: An autoregressive bijective transform as described in Jaini et al. (2019)
  applying following equation element-wise,
  
      :math:`y_n = c_n + \int^{x_n}_0\sum^K_{k=1}\left(\sum^R_{r=0}a^{(n)}_{r,k}u^r\right)du`
  
  where :math:`x_n` is the :math:`n`th input, :math:`y_n` is the :math:`n`th
  output, and :math:`c_n\in\mathbb{R}`,
  :math:`\left\{a^{(n)}_{r,k}\in\mathbb{R}\right\}` are learnable parameters
  that are the output of an autoregressive NN inputting
  :math:`x_{\prec n}={x_1,x_2,\ldots,x_{n-1}}`.
  
  Together with :class:`~pyro.distributions.TransformedDistribution` this provides
  a way to create richer variational approximations.
  
  Example usage:
  
  >>> from pyro.nn import AutoRegressiveNN
  >>> input_dim = 10
  >>> count_degree = 4
  >>> count_sum = 3
  >>> base_dist = dist.Normal(torch.zeros(input_dim), torch.ones(input_dim))
  >>> param_dims = [(count_degree + 1)*count_sum]
  >>> arn = AutoRegressiveNN(input_dim, [input_dim*10], param_dims)
  >>> transform = Polynomial(arn, input_dim=input_dim, count_degree=count_degree,
  ... count_sum=count_sum)
  >>> pyro.module("my_transform", transform)  # doctest: +SKIP
  >>> flow_dist = dist.TransformedDistribution(base_dist, [transform])
  >>> flow_dist.sample()  # doctest: +SKIP
  
  The inverse of this transform does not possess an analytical solution and is
  left unimplemented. However, the inverse is cached when the forward operation is
  called during sampling, and so samples drawn using a polynomial transform can be
  scored.
  
  :param autoregressive_nn: an autoregressive neural network whose forward call
      returns a tensor of real-valued
      numbers of size (batch_size, (count_degree+1)*count_sum, input_dim)
  :type autoregressive_nn: nn.Module
  :param count_degree: The degree of the polynomial to use for each element-wise
      transformation.
  :type count_degree: int
  :param count_sum: The number of polynomials to sum in each element-wise
      transformation.
  :type count_sum: int
  
  References:
  
  [1] Priyank Jaini, Kira A. Shelby, Yaoliang Yu. Sum-of-squares polynomial flow.
  [arXiv:1905.02325]
class_docstr_tok: ["An","autoregressive","bijective","transform","as","described","in","Jaini","et","al",".","(","2019",")","applying","following","equation","element-wise",",",":","math",":","`","y_n","=","c_n","+","\\int^","{","x_n","}","_0\\sum^K_","{","k=1","}","\\left","(","\\sum^R_","{","r=0","}","a^","{","(","n",")","}","_","{","r",",","k","}","u^r\\right",")","du","`","where",":","math",":","`","x_n","`","is","the",":","math",":","`","n","`","th","input",",",":","math",":","`","y_n","`","is","the",":","math",":","`","n","`","th","output",",","and",":","math",":","`","c_n\\in\\mathbb","{","R","}","`",",",":","math",":","`","\\left\\","{","a^","{","(","n",")","}","_","{","r",",","k","}","\\in\\mathbb","{","R","}","\\right\\","}","`","are","learnable","parameters","that","are","the","output","of","an","autoregressive","NN","inputting",":","math",":","`","x_","{","\\prec","n","}","=","{","x_1",",","x_2",",","\\ldots",",","x_","{","n-1","}","}","`",".","Together","with",":","class",":","`","~pyro.distributions.TransformedDistribution","`","this","provides","a","way","to","create","richer","variational","approximations",".","Example","usage",":",">",">",">","from","pyro.nn","import","AutoRegressiveNN",">",">",">","input_dim","=","10",">",">",">","count_degree","=","4",">",">",">","count_sum","=","3",">",">",">","base_dist","=","dist.Normal","(","torch.zeros","(","input_dim",")",",","torch.ones","(","input_dim",")",")",">",">",">","param_dims","=","[","(","count_degree","+","1",")","*","count_sum","]",">",">",">","arn","=","AutoRegressiveNN","(","input_dim",",","[","input_dim","*","10","]",",","param_dims",")",">",">",">","transform","=","Polynomial","(","arn",",","input_dim=input_dim",",","count_degree=count_degree",",","...","count_sum=count_sum",")",">",">",">","pyro.module","(","``","my_transform","''",",","transform",")","#","doctest",":","+SKIP",">",">",">","flow_dist","=","dist.TransformedDistribution","(","base_dist",",","[","transform","]",")",">",">",">","flow_dist.sample","(",")","#","doctest",":","+SKIP","The","inverse","of","this","transform","does","not","possess","an","analytical","solution","and","is","left","unimplemented",".","However",",","the","inverse","is","cached","when","the","forward","operation","is","called","during","sampling",",","and","so","samples","drawn","using","a","polynomial","transform","can","be","scored",".",":","param","autoregressive_nn",":","an","autoregressive","neural","network","whose","forward","call","returns","a","tensor","of","real-valued","numbers","of","size","(","batch_size",",","(","count_degree+1",")","*","count_sum",",","input_dim",")",":","type","autoregressive_nn",":","nn.Module",":","param","count_degree",":","The","degree","of","the","polynomial","to","use","for","each","element-wise","transformation",".",":","type","count_degree",":","int",":","param","count_sum",":","The","number","of","polynomials","to","sum","in","each","element-wise","transformation",".",":","type","count_sum",":","int","References",":","[","1","]","Priyank","Jaini",",","Kira","A.","Shelby",",","Yaoliang","Yu",".","Sum-of-squares","polynomial","flow",".","[","arXiv:1905.02325","]"]
code: def reset_parameters(self):
      stdv = 1.0 / math.sqrt(self.c.size(0))
      self.c.data.uniform_(-stdv, stdv)
  
file_path: pyro/pyro/distributions/transforms/polynomial.py
imports: import math
  import torch
  import torch.nn
  from pyro.nn import AutoRegressiveNN
  from ..None import constraints
  from ..torch_transform import TransformModule
  from ..util import copy_docs_from
label_desc: Use image node_id 2 for calling the Polynomial obj's underlying member method code with example usage: obj.reset_parameters() without return types