mindspore/docs/api/api_python/numpy/mindspore.numpy.interp.rst

23 lines
1.2 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.numpy.interp
======================
.. py:function:: mindspore.numpy.interp(x, xp, fp, left=None, right=None)
用于单调递增的样本点的一维线性插值。 返回包含给定离散数据点(xp, fp)的函数进行一维分段线性插值后x处的函数值。
.. note::
Numpy参数period不受支持。 不支持复数值。
参数:
- **x** (Union[int, float, bool, list, tuple, Tensor]) - 计算插值后的值时使用的x坐标。
- **xp** (Union[int, float, bool, list, tuple, Tensor]) - 元素为float的1-D序列输入数据点的x坐标必须递增。
- **fp** (Union[int, float, bool, list, tuple, Tensor]) - 元素为float的1-D序列输入数据点的y坐标`xp` 等长。
- **left** (float, 可选) - ``x < xp[0]`` 时返回的值,一旦存在,默认值为 ``fp[0]`` 。默认值: ``None``
- **right** (float, 可选) - ``x > xp[-1]`` 时返回的值,一旦存在,默认值为 ``fp[-1]`` 。默认值: ``None``
返回:
Tensor插值得到的值其shape与 `x` 相同。
异常:
- **ValueError** - 如果 `xp``fp` 不是一维的,或如果 `xp``fp` 的长度不同。