class_docstr: Piecewise linear distribution.
  
  This class represents the *quantile function* (i.e., the inverse CDF)
  associated with the a distribution, as a continuous, non-decreasing,
  piecewise linear function defined in the [0, 1] interval:
  
  .. math::
      q(x; \gamma, b, d) = \gamma + \sum_{l=0}^L b_l (x_l - d_l)_+
  
  where the input :math:`x \in [0,1]` and the parameters are
  
  - :math:`\gamma`: intercept at 0
  - :math:`b`: differences of the slopes in consecutive pieces
  - :math:`d`: knot positions
  
  Parameters
  ----------
  gamma
      Tensor containing the intercepts at zero
  slopes
      Tensor containing the slopes of each linear piece.
      All coefficients must be positive.
      Shape: ``(*gamma.shape, num_pieces)``
  knot_spacings
      Tensor containing the spacings between knots in the splines.
      All coefficients must be positive and sum to one on the last axis.
      Shape: ``(*gamma.shape, num_pieces)``
  F
class_docstr_tok: ["Piecewise","linear","distribution",".","This","class","represents","the","*","quantile","function","*","(","i.e.",",","the","inverse","CDF",")","associated","with","the","a","distribution",",","as","a","continuous",",","non-decreasing",",","piecewise","linear","function","defined","in","the","[","0",",","1","]","interval",":","..","math",":",":","q","(","x",";","\\gamma",",","b",",","d",")","=","\\gamma","+","\\sum_","{","l=0","}","^L","b_l","(","x_l","-","d_l",")","_+","where","the","input",":","math",":","`","x","\\in","[","0,1","]","`","and","the","parameters","are","-",":","math",":","`","\\gamma","`",":","intercept","at","0","-",":","math",":","`","b","`",":","differences","of","the","slopes","in","consecutive","pieces","-",":","math",":","`","d","`",":","knot","positions","Parameters","--","--","--","--","--","gamma","Tensor","containing","the","intercepts","at","zero","slopes","Tensor","containing","the","slopes","of","each","linear","piece",".","All","coefficients","must","be","positive",".","Shape",":","``","(","*","gamma.shape",",","num_pieces",")","``","knot_spacings","Tensor","containing","the","spacings","between","knots","in","the","splines",".","All","coefficients","must","be","positive","and","sum","to","one","on","the","last","axis",".","Shape",":","``","(","*","gamma.shape",",","num_pieces",")","``","F"]
docstr: Convert the trainable parameters to the original parameters of the
  splines, i.e., convert the slopes of each piece to the difference
  between slopes of consecutive pieces and knot spacings to knot
  positions.
  
  Parameters
  ----------
  F
  slopes
      Tensor of shape (*gamma.shape, num_pieces)
  knot_spacings
      Tensor of shape (*gamma.shape, num_pieces)
  
  Returns
  -------
  Tensor
      Tensor of shape (*gamma.shape, num_pieces)
  Tensor
      Tensor of shape (*gamma.shape, num_pieces)
docstr_tok: ["Convert","the","trainable","parameters","to","the","original","parameters","of","the","splines",",","i.e.",",","convert","the","slopes","of","each","piece","to","the","difference","between","slopes","of","consecutive","pieces","and","knot","spacings","to","knot","positions",".","Parameters","--","--","--","--","--","F","slopes","Tensor","of","shape","(","*","gamma.shape",",","num_pieces",")","knot_spacings","Tensor","of","shape","(","*","gamma.shape",",","num_pieces",")","Returns","--","--","--","-","Tensor","Tensor","of","shape","(","*","gamma.shape",",","num_pieces",")","Tensor","Tensor","of","shape","(","*","gamma.shape",",","num_pieces",")"]
code: def _to_orig_params(
      F, slopes: Tensor, knot_spacings: Tensor
  ) -> Tuple[Tensor, Tensor]:
      r"""
      Convert the trainable parameters to the original parameters of the
      splines, i.e., convert the slopes of each piece to the difference
      between slopes of consecutive pieces and knot spacings to knot
      positions.
  
      Parameters
      ----------
      F
      slopes
          Tensor of shape (*gamma.shape, num_pieces)
      knot_spacings
          Tensor of shape (*gamma.shape, num_pieces)
  
      Returns
      -------
      Tensor
          Tensor of shape (*gamma.shape, num_pieces)
      Tensor
          Tensor of shape (*gamma.shape, num_pieces)
      """
  
      # b: the difference between slopes of consecutive pieces
      # shape (..., num_pieces - 1)
      b = F.slice_axis(
          slopes, axis=-1, begin=1, end=None
      ) - F.slice_axis(slopes, axis=-1, begin=0, end=-1)
  
      # Add slope of first piece to b: b_0 = m_0
      m_0 = F.slice_axis(slopes, axis=-1, begin=0, end=1)
      b = F.concat(m_0, b, dim=-1)
  
      # The actual position of the knots is obtained by cumulative sum of
      # the knot spacings. The first knot position is always 0 for quantile
      # functions; cumsum will take care of that.
      knot_positions = cumsum(F, knot_spacings, exclusive=True)
  
      return b, knot_positions
  
imports: from typing import Dict, List, Optional, Tuple, Union, cast
  import mxnet
  import numpy
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from gluonts.mx.util import cumsum
  from .bijection import AffineTransformation, Bijection
  from .distribution import Distribution, getF
  from .distribution_output import ArgProj, DistributionOutput
  from .transformed_distribution import TransformedDistribution
label_desc: Use image node_id 4 for calling the PiecewiseLinear obj's underlying member method code with example usage: obj._to_orig_params(F, slopes, knot_spacings) and returns: b,  knot_positions