class_docstr: A conditional 'planar' bijective transform using the equation,
  
      :math:`\mathbf{y} = \mathbf{x} + \mathbf{u}\tanh(\mathbf{w}^T\mathbf{z}+b)`
  
  where :math:`\mathbf{x}` are the inputs with dimension :math:`D`,
  :math:`\mathbf{y}` are the outputs, and the pseudo-parameters
  :math:`b\in\mathbb{R}`, :math:`\mathbf{u}\in\mathbb{R}^D`, and
  :math:`\mathbf{w}\in\mathbb{R}^D` are the output of a function, e.g. a NN,
  with input :math:`z\in\mathbb{R}^{M}` representing the context variable to
  condition on. For this to be an invertible transformation, the condition
  :math:`\mathbf{w}^T\mathbf{u}>-1` is enforced.
  
  Together with :class:`~pyro.distributions.ConditionalTransformedDistribution`
  this provides a way to create richer variational approximations.
  
  Example usage:
  
  >>> from pyro.nn.dense_nn import DenseNN
  >>> input_dim = 10
  >>> context_dim = 5
  >>> batch_size = 3
  >>> base_dist = dist.Normal(torch.zeros(input_dim), torch.ones(input_dim))
  >>> param_dims = [1, input_dim, input_dim]
  >>> hypernet = DenseNN(context_dim, [50, 50], param_dims)
  >>> transform = ConditionalPlanar(hypernet)
  >>> z = torch.rand(batch_size, context_dim)
  >>> flow_dist = dist.ConditionalTransformedDistribution(base_dist,
  ... [transform]).condition(z)
  >>> flow_dist.sample(sample_shape=torch.Size([batch_size])) # 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 the planar transform can be
  scored.
  
  :param nn: a function inputting the context variable and outputting a triplet of
      real-valued parameters of dimensions :math:`(1, D, D)`.
  :type nn: callable
  
  References:
  [1] Variational Inference with Normalizing Flows [arXiv:1505.05770]
  Danilo Jimenez Rezende, Shakir Mohamed
code: def __init__(self, nn):
      super().__init__()
      self.nn = nn
  
imports: import math
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.distributions import Transform, constraints
  from pyro.nn import DenseNN
  from ..conditional import ConditionalTransformModule
  from ..torch_transform import TransformModule
  from ..util import copy_docs_from
label_desc: Use image node_id 1 to create a new ConditionalPlanar object from inherited base classes: ConditionalTransformModule with example: obj = ConditionalPlanar(nn)