class_docstr: Piecewise polynomial in terms of coefficients and breakpoints
  The polynomial between ``x[i]`` and ``x[i + 1]`` is written in the
  local power basis::
  
      S = sum(c[m, i] * (xp - x[i]) ** (k - m) for m in range(k + 1))
  
  where ``k`` is the degree of the polynomial.
  
  Parameters
  ----------
  c : ndarray, shape (k, m, ...)
      Polynomial coefficients, order `k` and `m` intervals.
  x : ndarray, shape (m+1,)
      Polynomial breakpoints. Must be sorted in either increasing or
      decreasing order.
  extrapolate : bool or 'periodic', optional
      If bool, determines whether to extrapolate to out-of-bounds points
      based on first and last intervals, or to return NaNs. If 'periodic',
      periodic extrapolation is used. Default is True.
  axis : int, optional
      Interpolation axis. Default is zero.
  
  Attributes
  ----------
  x : ndarray
      Breakpoints.
  c : ndarray
      Coefficients of the polynomials. They are reshaped
      to a 3-D array with the last dimension representing
      the trailing dimensions of the original coefficient array.
  axis : int
      Interpolation axis.
  
  See also
  --------
  BPoly : piecewise polynomials in the Bernstein basis
  
  Notes
  -----
  High-order polynomials in the power basis can be numerically
  unstable. Precision problems can start to appear for orders
  larger than 20-30.
  
  .. seealso:: :class:`scipy.interpolate.BSpline`
class_docstr_tok: ["Piecewise","polynomial","in","terms","of","coefficients","and","breakpoints","The","polynomial","between","``","x","[","i","]","``","and","``","x","[","i","+","1","]","``","is","written","in","the","local","power","basis",":",":","S","=","sum","(","c","[","m",",","i","]","*","(","xp","-","x","[","i","]",")","*","*","(","k","-","m",")","for","m","in","range","(","k","+","1",")",")","where","``","k","``","is","the","degree","of","the","polynomial",".","Parameters","--","--","--","--","--","c",":","ndarray",",","shape","(","k",",","m",",","...",")","Polynomial","coefficients",",","order","`","k","`","and","`","m","`","intervals",".","x",":","ndarray",",","shape","(","m+1",",",")","Polynomial","breakpoints",".","Must","be","sorted","in","either","increasing","or","decreasing","order",".","extrapolate",":","bool","or","'periodic","'",",","optional","If","bool",",","determines","whether","to","extrapolate","to","out-of-bounds","points","based","on","first","and","last","intervals",",","or","to","return","NaNs",".","If","'periodic","'",",","periodic","extrapolation","is","used",".","Default","is","True",".","axis",":","int",",","optional","Interpolation","axis",".","Default","is","zero",".","Attributes","--","--","--","--","--","x",":","ndarray","Breakpoints",".","c",":","ndarray","Coefficients","of","the","polynomials",".","They","are","reshaped","to","a","3-D","array","with","the","last","dimension","representing","the","trailing","dimensions","of","the","original","coefficient","array",".","axis",":","int","Interpolation","axis",".","See","also","--","--","--","--","BPoly",":","piecewise","polynomials","in","the","Bernstein","basis","Notes","--","--","-","High-order","polynomials","in","the","power","basis","can","be","numerically","unstable",".","Precision","problems","can","start","to","appear","for","orders","larger","than","20-30",".","..","seealso",":",":",":","class",":","`","scipy.interpolate.BSpline","`"]
docstr: Construct a piecewise polynomial from a spline
  
  Parameters
  ----------
  tck
      A spline, as a (knots, coefficients, degree) tuple or
      a BSpline object.
  extrapolate : bool or 'periodic', optional
      If bool, determines whether to extrapolate to out-of-bounds points
      based on first and last intervals, or to return NaNs.
      If 'periodic', periodic extrapolation is used. Default is True.
code: def from_spline(cls, tck, extrapolate=None):
      """
      Construct a piecewise polynomial from a spline
  
      Parameters
      ----------
      tck
          A spline, as a (knots, coefficients, degree) tuple or
          a BSpline object.
      extrapolate : bool or 'periodic', optional
          If bool, determines whether to extrapolate to out-of-bounds points
          based on first and last intervals, or to return NaNs.
          If 'periodic', periodic extrapolation is used. Default is True.
      """
      if isinstance(tck, BSpline):
          t, c, k = tck.tck
          if extrapolate is None:
              extrapolate = tck.extrapolate
      else:
          t, c, k = tck
  
      spl = BSpline(t, c, k, extrapolate=extrapolate)
      cvals = cupy.empty((k + 1, len(t) - 1), dtype=c.dtype)
      for m in range(k, -1, -1):
          y = spl(t[:-1], nu=m)
          cvals[k - m, :] = y / spec.gamma(m + 1)
  
      return cls.construct_fast(cvals, t, extrapolate)
  
imports: import math
  import cupy
  from cupy._core import internal
  from cupy._core._scalar import get_typename
  from cupy_backends.cuda.api import runtime
  from cupyx.scipy import special
  from cupyx.scipy.interpolate._bspline import BSpline, _get_dtype
  import numpy
label_desc: Use image node_id 7 for calling the PPoly obj's underlying member method code with example usage: obj.from_spline(cls, tck, extrapolate) and returns: cls