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.WithLossCell.rst 912 B

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. mindspore.nn.WithLossCell
  2. =========================
  3. .. py:class:: mindspore.nn.WithLossCell(backbone, loss_fn)
  4. 包含损失函数的Cell。
  5. 封装 `backbone` 和 `loss_fn` 。此Cell接受数据和标签作为输入,并将返回损失函数作为计算结果。
  6. **参数:**
  7. - **backbone** (Cell) - 要封装的骨干网络。
  8. - **loss_fn** (Cell) - 用于计算损失函数。
  9. **输入:**
  10. - **data** (Tensor) - shape为 :math:`(N, \ldots)` 的Tensor。
  11. - **label** (Tensor) - shape为 :math:`(N, \ldots)` 的Tensor。
  12. **输出:**
  13. Tensor,loss值,其shape通常为 :math:`()` 。
  14. **异常:**
  15. **TypeError**:`data` 或 `label` 的数据类型既不是float16也不是float32。
  16. .. py:method:: backbone_network
  17. :property:
  18. 获取骨干网络。
  19. **返回:**
  20. Cell,骨干网络。