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

50 lines
1.7 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.nn.probability.dpn.VAE
================================
.. py:class:: mindspore.nn.probability.dpn.VAE
变分自动编码器 (VAE)。
VAE 定义了一个生成模型Z从先验中采样然后由解码器用于重建X。有关更多详细信息请参阅 `自动编码变分贝叶斯 <https://arxiv.org/abs/1312.6114>`_
.. note:: 定义编码器和解码器时,编码器的输出 Tensor 和解码器的输入Tensor 的 shape 必须是 :math:`(N, hidden\_size)`。 潜在大小必须小于或等于隐藏大小。
**参数:**
- **encoder** (Cell) - 定义为编码器的深度神经网络 (DNN) 模型。
- **decoder** (Cell) - 定义为解码器的深度神经网络 (DNN) 模型。
- **hidden_size** (int) - 编码器输出 Tensor 的大小。
- **latent_size** (int) - 潜在空间的大小。
**输入:**
- **input** (Tensor) - 输入 Tensor 的 shape 是 :math:`(N, C, H, W)`,与编码器的输入相同。
**输出:**
- **output** (Tuple) - recon_xTensorxTensormuTensorstdTensor
.. py:method:: generate_sample(generate_nums, shape)
从潜在空间中随机采样以生成样本。
**参数:**
- **generate_nums** int- 要生成的样本数。
- **shape** tuple- 样本的 shape它必须是 (generate_nums, C, H, W) 或 (-1, C, H, W)。
**返回:**
Tensor生成的样本。
.. py:method:: reconstruct_sample(×)
从原始数据重建样本。
**参数:**
- **x** (Tensor) - 要重构的输入 Tensorshape 为 (N, C, H, W)。
**返回:**
Tensor重构的样本。