class_docstr: Base class for piecewise polynomials.
class_docstr_tok: ["Base","class","for","piecewise","polynomials","."]
code: def __init__(self, c, x, extrapolate=None, axis=0):
      self.c = cupy.asarray(c)
      self.x = cupy.ascontiguousarray(x, dtype=cupy.float64)
  
      if extrapolate is None:
          extrapolate = True
      elif extrapolate != "periodic":
          extrapolate = bool(extrapolate)
      self.extrapolate = extrapolate
  
      if self.c.ndim < 2:
          raise ValueError(
              "Coefficients array must be at least " "2-dimensional."
          )
  
      if not (0 <= axis < self.c.ndim - 1):
          raise ValueError(
              "axis=%s must be between 0 and %s"
              % (axis, self.c.ndim - 1)
          )
  
      self.axis = axis
      if axis != 0:
          # move the interpolation axis to be the first one in self.c
          # More specifically, the target shape for self.c is (k, m, ...),
          # and axis !=0 means that we have c.shape (..., k, m, ...)
          #                                               ^
          #                                              axis
          # So we roll two of them.
          self.c = cupy.moveaxis(self.c, axis + 1, 0)
          self.c = cupy.moveaxis(self.c, axis + 1, 0)
  
      if self.x.ndim != 1:
          raise ValueError("x must be 1-dimensional")
      if self.x.size < 2:
          raise ValueError("at least 2 breakpoints are needed")
      if self.c.ndim < 2:
          raise ValueError("c must have at least 2 dimensions")
      if self.c.shape[0] == 0:
          raise ValueError("polynomial must be at least of order 0")
      if self.c.shape[1] != self.x.size - 1:
          raise ValueError("number of coefficients != len(x)-1")
      dx = cupy.diff(self.x)
      if not (cupy.all(dx >= 0) or cupy.all(dx <= 0)):
          raise ValueError(
              "`x` must be strictly increasing or decreasing."
          )
  
      dtype = self._get_dtype(self.c.dtype)
      self.c = cupy.ascontiguousarray(self.c, dtype=dtype)
  
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 1 to create a new _PPolyBase object  with example: obj = _PPolyBase(c, x, extrapolate, axis)