mindspore.nn.probability.dpn.ConditionalVAE
- class mindspore.nn.probability.dpn.ConditionalVAE(encoder, decoder, hidden_size, latent_size, num_classes)[source]
Conditional Variational Auto-Encoder (CVAE).
The difference with VAE is that CVAE uses labels information. For more details, refer to Learning Structured Output Representation using Deep Conditional Generative Models.
Note
When encoder and decoder ard defined, the shape of the encoder’s output tensor and decoder’s input tensor must be \((N, hidden\_size)\). The latent_size must be less than or equal to the hidden_size.
- Parameters
- Inputs:
input_x (Tensor) - The shape of input tensor is \((N, C, H, W)\), which is the same as the input of encoder.
input_y (Tensor) - The tensor of the target data, the shape is \((N,)\).
- Outputs:
output (tuple) - (recon_x(Tensor), x(Tensor), mu(Tensor), std(Tensor)).
- Supported Platforms:
Ascend
GPU
- construct(x, y)[source]
The input are x and y, so the WithLossCell method needs to be rewritten when using cvae interface.