Skip to content

Latest commit

 

History

History
107 lines (57 loc) · 1.84 KB

SoftmaxTransform_cn.rst

File metadata and controls

107 lines (57 loc) · 1.84 KB

SoftmaxTransform

.. py:class:: paddle.distribution.SoftmaxTransform

Softmax 变换,首先进行 y = exp(x) 变换,然后归一化。

Softmax 变换将向量变换为单纯形。

Note

Softmax 不是双射函数,所以 forward_log_det_jacobianinverse_log_det_jacobian 未实现。

代码示例

COPY-FROM: paddle.distribution.SoftmaxTransform

方法

forward(x)

计算正变换 y=f(x) 的结果。

参数

返回

  • y (Tensor) - 正变换的计算结果。

inverse(y)

计算逆变换 x = f^{-1}(y)

参数

  • y (Tensor) - 逆变换的输入参数。

返回

Tensor,逆变换的计算结果。

forward_log_det_jacobian(x)

计算正变换雅可比行列式绝对值的对数。

如果变换不是一一映射,则雅可比矩阵不存在,返回 NotImplementedError

参数

  • x (Tensor) - 输入参数。

返回

Tensor,正变换雅可比行列式绝对值的对数。

inverse_log_det_jacobian(y)

计算逆变换雅可比行列式绝对值的对数。

forward_log_det_jacobian 互为负数。

参数

  • y (Tensor) - 输入参数。

返回

Tensor,逆变换雅可比行列式绝对值的对数。

forward_shape(shape)

推断正变换输出形状。

参数

  • shape (Sequence[int]) - 正变换输入的形状。

返回

Sequence[int],正变换输出的形状。

inverse_shape(shape)

推断逆变换输出形状。

参数

  • shape (Sequence[int]) - 逆变换输入的形状。

返回

Sequence[int],逆变换输出的形状。