mindspore/docs/api/api_python/ops/mindspore.ops.func_jet.rst

25 lines
1.4 KiB
ReStructuredText
Raw 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.ops.jet
=================
.. py:function:: mindspore.ops.jet(fn, primals, series)
计算函数或网络输出对输入的高阶微分。给定待求导函数的原始输入和自定义的1到n阶导数将返回函数输出对输入的第1到n阶导数。一般情况建议输入的1阶导数值为全1更高阶的导数值为全0这与输入对本身的导数情况是一致的。
.. note::
-`primals` 是int型的Tensor会被转化成float32格式进行计算。
参数:
- **fn** (Union[Function, Cell]) - 待求导的函数或网络。
- **primals** (Union[Tensor, tuple[Tensor]]) - `fn` 的输入单输入的type为Tensor多输入的type为Tensor组成的tuple。
- **series** (Union[Tensor, tuple[Tensor]]) - 输入的原始第1到第n阶导数。若为tuple则长度与数据类型应与 `primals` 一致。type与 `primals` 相同Tensor第一维度i对应输出对输入的第1到第i+1阶导数。
返回:
tuple`out_primals``out_series` 组成。
- **out_primals** (Union[Tensor, list[Tensor]]) - `fn(primals)` 的结果。
- **out_series** (Union[Tensor, list[Tensor]]) - `fn` 输出对输入的第1到n阶导数。
异常:
- **TypeError** - `primals` 不是Tensor或tuple。
- **TypeError** - `primals``series` 的type不一致。