class_docstr: Distribution class for the Incremental (Spline) Quantile Function in the
  paper ``Learning Quantile Functions without Quantile Crossing for
  Distribution-free Time Series Forecasting``
  by Park, Robinson, Aubet, Kan, Gasthaus, Wang
  Parameters
  ----------
  spline_knots, spline_heights
      Tensor parametrizing the x-positions (y-positions) of the spline knots
      Shape: (*batch_shape, (num_qk-1), num_pieces)
  qk_x, qk_y
      Tensor containing the increasing x-positions (y-positions) of the
      quantile knots, Shape: (*batch_shape, num_qk)
  beta_l, beta_r
      Tensor containing the non-negative learnable parameter of the
      left (right) tail, Shape: (*batch_shape,)
class_docstr_tok: ["Distribution","class","for","the","Incremental","(","Spline",")","Quantile","Function","in","the","paper","``","Learning","Quantile","Functions","without","Quantile","Crossing","for","Distribution-free","Time","Series","Forecasting","``","by","Park",",","Robinson",",","Aubet",",","Kan",",","Gasthaus",",","Wang","Parameters","--","--","--","--","--","spline_knots",",","spline_heights","Tensor","parametrizing","the","x-positions","(","y-positions",")","of","the","spline","knots","Shape",":","(","*","batch_shape",",","(","num_qk-1",")",",","num_pieces",")","qk_x",",","qk_y","Tensor","containing","the","increasing","x-positions","(","y-positions",")","of","the","quantile","knots",",","Shape",":","(","*","batch_shape",",","num_qk",")","beta_l",",","beta_r","Tensor","containing","the","non-negative","learnable","parameter","of","the","left","(","right",")","tail",",","Shape",":","(","*","batch_shape",",",")"]
docstr: Function to parameterize the x or y positions of the spline knots
  Parameters
  ----------
  spline_knots
      variable that parameterizes the spline knot positions
  qk
      x or y positions of the quantile knots (qk),
      with index=1, ..., num_qk-1,
      shape: (*batch_shape, num_qk-1)
  qk_plus
      x or y positions of the quantile knots (qk),
      with index=2, ..., num_qk,
      shape: (*batch_shape, num_qk-1)
  num_pieces
      number of spline knot pieces
  tol
      tolerance hyperparameter for numerical stability
  Returns
  -------
  sk
      x or y positions of the spline knots (sk),
      shape: (*batch_shape, num_qk-1, num_pieces)
  delta_sk
      difference of x or y positions of the spline knots (sk),
      shape: (*batch_shape, num_qk-1, num_pieces)
docstr_tok: ["Function","to","parameterize","the","x","or","y","positions","of","the","spline","knots","Parameters","--","--","--","--","--","spline_knots","variable","that","parameterizes","the","spline","knot","positions","qk","x","or","y","positions","of","the","quantile","knots","(","qk",")",",","with","index=1",",","...",",","num_qk-1",",","shape",":","(","*","batch_shape",",","num_qk-1",")","qk_plus","x","or","y","positions","of","the","quantile","knots","(","qk",")",",","with","index=2",",","...",",","num_qk",",","shape",":","(","*","batch_shape",",","num_qk-1",")","num_pieces","number","of","spline","knot","pieces","tol","tolerance","hyperparameter","for","numerical","stability","Returns","--","--","--","-","sk","x","or","y","positions","of","the","spline","knots","(","sk",")",",","shape",":","(","*","batch_shape",",","num_qk-1",",","num_pieces",")","delta_sk","difference","of","x","or","y","positions","of","the","spline","knots","(","sk",")",",","shape",":","(","*","batch_shape",",","num_qk-1",",","num_pieces",")"]
code: def parameterize_spline(
      spline_knots: torch.Tensor,
      qk: torch.Tensor,
      qk_plus: torch.Tensor,
      tol: float = 1e-4,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      r"""
      Function to parameterize the x or y positions of the spline knots
      Parameters
      ----------
      spline_knots
          variable that parameterizes the spline knot positions
      qk
          x or y positions of the quantile knots (qk),
          with index=1, ..., num_qk-1,
          shape: (*batch_shape, num_qk-1)
      qk_plus
          x or y positions of the quantile knots (qk),
          with index=2, ..., num_qk,
          shape: (*batch_shape, num_qk-1)
      num_pieces
          number of spline knot pieces
      tol
          tolerance hyperparameter for numerical stability
      Returns
      -------
      sk
          x or y positions of the spline knots (sk),
          shape: (*batch_shape, num_qk-1, num_pieces)
      delta_sk
          difference of x or y positions of the spline knots (sk),
          shape: (*batch_shape, num_qk-1, num_pieces)
      """
  
      # The spacing between spline knots is parameterized
      # by softmax function (in [0,1] and sum to 1)
      # We add tol to prevent overflow in computing 1/spacing in spline CRPS
      # After adding tol, it is normalized by
      # (1 + num_pieces * tol) to keep the sum-to-1 property
  
      num_pieces = spline_knots.shape[-1]
  
      delta_x = (F.softmax(spline_knots, dim=-1) + tol) / (
          1 + num_pieces * tol
      )
  
      zero_tensor = torch.zeros_like(
          delta_x[..., 0:1]
      )  # 0:1 for keeping dimension
      x = torch.cat(
          [zero_tensor, torch.cumsum(delta_x, dim=-1)[..., :-1]], dim=-1
      )
  
      qk, qk_plus = qk.unsqueeze(dim=-1), qk_plus.unsqueeze(dim=-1)
      sk = x * (qk_plus - qk) + qk
      delta_sk = delta_x * (qk_plus - qk)
  
      return sk, delta_sk
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  from torch.distributions import AffineTransform, TransformedDistribution
  from gluonts.core.component import validated
  from .distribution_output import DistributionOutput
label_desc: Use image node_id 3 for calling the ISQF obj's underlying member method code with example usage: obj.parameterize_spline(spline_knots, qk, qk_plus, tol) and returns: sk,  delta_sk