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

28 lines
1.0 KiB
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)
2022-07-01 10:49:56 +08:00
为 BNN 生成一个合适的 WithLossCell用损失函数包装贝叶斯网络。
2022-05-27 14:23:35 +08:00
2022-07-18 15:22:30 +08:00
参数:
- **backbone** (Cell) - 目标网络。
- **loss_fn** (Cell) - 用于计算损失的损失函数。
- **dnn_factor** (int, float) - backbone 的损失系数由损失函数计算。默认值1。
- **bnn_factor** (int, float) - KL 损失系数,即贝叶斯层的 KL 散度。默认值1。
2022-05-27 14:23:35 +08:00
2022-07-18 15:22:30 +08:00
输入:
- **data** (Tensor) - `data` 的 shape :math:`(N, \ldots)`
- **label** (Tensor) - `label` 的 shape :math:`(N, \ldots)`
2022-05-27 14:23:35 +08:00
2022-07-18 15:22:30 +08:00
输出:
Tensor任意 shape 的标量 Tensor。
2022-05-27 14:23:35 +08:00
.. py:method:: backbone_network
:property:
2022-07-01 10:49:56 +08:00
返回backbone_network。
2022-05-27 14:23:35 +08:00
2022-07-18 15:22:30 +08:00
返回:
Cellbackbone_network。