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.Loss.rst 845 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. mindspore.nn.Loss
  2. =================
  3. .. py:class:: mindspore.nn.Loss
  4. 计算loss的平均值。如果每 :math:`n` 次迭代调用一次 `update` 方法,则计算结果为:
  5. .. math::
  6. loss = \frac{\sum_{k=1}^{n}loss_k}{n}
  7. .. py:method:: clear()
  8. 内部评估结果清零。
  9. .. py:method:: eval()
  10. 计算loss的平均值。
  11. **返回:**
  12. Float,loss的平均值。
  13. **异常:**
  14. - **RuntimeError** - 样本总数为0。
  15. .. py:method:: update(*inputs)
  16. 更新内部评估结果。
  17. **参数:**
  18. - **inputs** - 输入只包含一个元素,且该元素为loss。loss的维度必须为0或1。
  19. **异常:**
  20. - **ValueError** - `inputs` 的长度不为1。
  21. - **ValueError** - `inputs` 的维度不为0或1。