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.nn.LogSoftmax.rst 989 B

4 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. mindspore.nn.LogSoftmax
  2. =============================
  3. .. py:class:: mindspore.nn.LogSoftmax(axis=-1)
  4. Log Softmax激活函数。
  5. 按元素计算Log Softmax激活函数。
  6. 输入经Softmax函数、Log函数转换后,值的范围在[-inf,0)。
  7. Log Softmax定义如下:
  8. .. math::
  9. \text{logsoftmax}(x_i) = \log \left(\frac{\exp(x_i)}{\sum_{j=0}^{n-1} \exp(x_j)}\right),
  10. 其中,:math:`x_i` 是输入Tensor的一个元素。
  11. **参数:**
  12. **axis** (int) - Log Softmax运算的axis,-1表示最后一个维度。默认值:-1。
  13. **输入:**
  14. - **x** (Tensor) - Log Softmax的输入,数据类型为float16或float32。
  15. **输出:**
  16. Tensor,数据类型和shape与 `x` 相同,输出值的范围在[-inf,0)。
  17. **异常:**
  18. - **TypeError** - `axis` 不是int。
  19. - **TypeError** - `x` 的数据类型既不是float16也不是float32。
  20. - **ValueError** - `axis` 不在[-len(x), len(x))范围中。