code: def cumprod(vari, axis=None):
      
      if isinstance(vari, Poly):
          if np.prod(vari.shape) == 1:
              return vari.copy()
          if axis is None:
              vari = chaospy.poly.shaping.flatten(vari)
              axis = 0
  
          vari = chaospy.poly.shaping.rollaxis(vari, axis)
          out = [vari[0]]
  
          for poly in vari[1:]:
              out.append(out[-1]*poly)
          return Poly(out, vari.dim, vari.shape, vari.dtype)
  
      return np.cumprod(vari, axis)
docs: Perform the cumulative product of a shapeable quantity over a given axis.
  
      Args:
          vari (chaospy.poly.base.Poly, numpy.ndarray):
              Input data.
          axis (int):
              Axis over which the sum is taken. By default ``axis`` is None, and
              all elements are summed.
  
      Returns:
          (chaospy.poly.base.Poly):
              An array shaped as ``vari`` but with the specified axis removed.
  
      Examples:
          >>> vari = cp.prange(4)
          >>> print(vari)
          [1, q0, q0^2, q0^3]
          >>> print(cp.cumprod(vari))
          [1, q0, q0^3, q0^6]