code: def conditional_spline(
      input_dim,
      context_dim,
      hidden_dims=None,
      count_bins=8,
      bound=3.0,
      order="linear",
  ):
      """
      A helper function to create a
      :class:`~pyro.distributions.transforms.ConditionalSpline` object that takes care
      of constructing a dense network with the correct input/output dimensions.
  
      :param input_dim: Dimension of input variable
      :type input_dim: int
      :param context_dim: Dimension of context variable
      :type context_dim: int
      :param hidden_dims: The desired hidden dimensions of the dense network. Defaults
          to using [input_dim * 10, input_dim * 10]
      :type hidden_dims: list[int]
      :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
  
      """
  
      if hidden_dims is None:
          hidden_dims = [input_dim * 10, input_dim * 10]
  
      if order == "linear":
          nn = DenseNN(
              context_dim,
              hidden_dims,
              param_dims=[
                  input_dim * count_bins,
                  input_dim * count_bins,
                  input_dim * (count_bins - 1),
                  input_dim * count_bins,
              ],
          )
      elif order == "quadratic":
          nn = DenseNN(
              context_dim,
              hidden_dims,
              param_dims=[
                  input_dim * count_bins,
                  input_dim * count_bins,
                  input_dim * (count_bins - 1),
              ],
          )
  
      else:
          raise ValueError(
              "Keyword argument 'order' must be one of ['linear', 'quadratic'], but '{}' was found!".format(
                  order
              )
          )
  
      return ConditionalSpline(
          nn, input_dim, count_bins, bound=bound, order=order
      )
  
imports: 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 6 for calling a global function with example usage: conditional_spline(input_dim, context_dim, hidden_dims, count_bins, bound, order) and returns: ConditionalSpline