You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Softmax.rst 1.1 kB

123456789101112131415161718192021222324252627282930313233
  1. mindspore.ops.Softmax
  2. ======================
  3. .. py:class:: mindspore.ops.Softmax(axis=-1)
  4. Softmax函数。
  5. 在指定轴上使用Softmax函数做归一化操作。假设指定轴 :math:`x` 上有切片,那么每个元素 :math:`x_i` 所对应的Softmax函数如下所示:
  6. .. math::
  7. \text{output}(x_i) = \frac{exp(x_i)}{\sum_{j = 0}^{N-1}\exp(x_j)},
  8. 其中 :math:`N` 代表Tensor的长度。
  9. **参数:**
  10. - **axis** (Union[int, tuple]) - 指定Softmax操作的轴。默认值:-1。
  11. **输入:**
  12. - **logits** (Tensor) - Softmax的输入,任意维度的Tensor。其数据类型为float16或float32。
  13. **输出:**
  14. Tensor,数据类型和shape与 `logits` 相同。
  15. **异常:**
  16. - **TypeError** - `axis` 既不是int也不是tuple。
  17. - **TypeError** - `logits` 的数据类型既不是float16也不是float32。
  18. - **ValueError** - `axis` 是长度小于1的tuple。
  19. - **ValueError** - `axis` 是一个tuple,其元素不全在[-len(logits.shape), len(logits.shape))范围中。