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"]
code: def __init__(
      self, gamma: Tensor, slopes: Tensor, knot_spacings: Tensor
  ) -> None:
      self.gamma = gamma
      self.slopes = slopes
      self.knot_spacings = knot_spacings
  
      # Since most of the calculations are easily expressed in the original
      # parameters, we transform the learned parameters back
      self.b, self.knot_positions = PiecewiseLinear._to_orig_params(
          self.F, slopes, knot_spacings
      )
  
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 1 to create a new PiecewiseLinear object from inherited base classes: Distribution with example: obj = PiecewiseLinear(gamma, slopes, knot_spacings)