mindspore/docs/api/api_python/probability/mindspore.nn.probability.bn...

32 lines
1001 B
ReStructuredText
Raw Normal View History

2022-05-27 14:23:35 +08:00
mindspore.nn.probability.bnn_layers.WithBNNLossCell
===================================================
.. py:class:: mindspore.nn.probability.bnn_layers.WithBNNLossCell(backbone, loss_fn, dnn_factor=1, bnn_factor=1)
为 BNN 生成一个合适的 WithLossCell用损失函数包裹贝叶斯网络。
**参数:**
- **backbone** (Cell) - 目标网络。
- **loss_fn** (Cell) - 用于计算损失的损失函数。
- **dnn_factor** (int, float) backbone 的损失系数由损失函数计算。默认值1。
- **bnn_factor** (int, float) - KL 损失系数,即贝叶斯层的 KL 散度。默认值1。
**输入:**
- **data** (Tensor) - `data` 的 shape :math:`(N, \ldots)`
- **label** (Tensor) - `label` 的 shape :math:`(N, \ldots)`
**输出:**
Tensor任意 shape 的标量 Tensor。
.. py:method:: backbone_network
:property:
返回骨干网。
**返回:**
Cell骨干网。