class_docstr: Poincaré Variational Autoencoder model.
  
  Args:
      model_config (PoincareVAEConfig): The Poincaré Variational Autoencoder configuration
          setting the main parameters of the model.
  
      encoder (BaseEncoder): An instance of BaseEncoder (inheriting from `torch.nn.Module` which
          plays the role of encoder. This argument allows you to use your own neural networks
          architectures if desired. If None is provided, a simple Multi Layer Preception
          (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.
  
      decoder (BaseDecoder): An instance of BaseDecoder (inheriting from `torch.nn.Module` which
          plays the role of decoder. This argument allows you to use your own neural networks
          architectures if desired. If None is provided, a simple Multi Layer Preception
          (https://en.wikipedia.org/wiki/Multilayer_perceptron) is used. Default: None.
  
  .. note::
      For high dimensional data we advice you to provide you own network architectures. With the
      provided MLP you may end up with a ``MemoryError``.
class_docstr_tok: ["Poincar\u00e9","Variational","Autoencoder","model",".","Args",":","model_config","(","PoincareVAEConfig",")",":","The","Poincar\u00e9","Variational","Autoencoder","configuration","setting","the","main","parameters","of","the","model",".","encoder","(","BaseEncoder",")",":","An","instance","of","BaseEncoder","(","inheriting","from","`","torch.nn.Module","`","which","plays","the","role","of","encoder",".","This","argument","allows","you","to","use","your","own","neural","networks","architectures","if","desired",".","If","None","is","provided",",","a","simple","Multi","Layer","Preception","(","https",":","\/\/en.wikipedia.org\/wiki\/Multilayer_perceptron",")","is","used",".","Default",":","None",".","decoder","(","BaseDecoder",")",":","An","instance","of","BaseDecoder","(","inheriting","from","`","torch.nn.Module","`","which","plays","the","role","of","decoder",".","This","argument","allows","you","to","use","your","own","neural","networks","architectures","if","desired",".","If","None","is","provided",",","a","simple","Multi","Layer","Preception","(","https",":","\/\/en.wikipedia.org\/wiki\/Multilayer_perceptron",")","is","used",".","Default",":","None",".","..","note",":",":","For","high","dimensional","data","we","advice","you","to","provide","you","own","network","architectures",".","With","the","provided","MLP","you","may","end","up","with","a","``","MemoryError","``","."]
code: def __init__(
      self,
      model_config: PoincareVAEConfig,
      encoder: Optional[BaseEncoder] = None,
      decoder: Optional[BaseDecoder] = None,
  ):
      VAE.__init__(
          self,
          model_config=model_config,
          encoder=encoder,
          decoder=decoder,
      )
  
      self.model_name = "PoincareVAE"
  
      self.latent_manifold = PoincareBall(
          dim=model_config.latent_dim, c=model_config.curvature
      )
  
      if model_config.prior_distribution == "riemannian_normal":
          self.prior = RiemannianNormal
      else:
          self.prior = WrappedNormal
  
      if model_config.posterior_distribution == "riemannian_normal":
          warnings.warn(
              "Carefull, this model expects the encoder to give a one dimensional "
              "`log_concentration` tensor for the Riemannian normal distribution. "
              "Make sure the encoder actually outputs this."
          )
          self.posterior = RiemannianNormal
      else:
          self.posterior = WrappedNormal
  
      if encoder is None:
          if model_config.posterior_distribution == "riemannian_normal":
              encoder = Encoder_SVAE_MLP(model_config)
          else:
              encoder = Encoder_VAE_MLP(model_config)
          self.model_config.uses_default_encoder = True
  
      else:
          self.model_config.uses_default_encoder = False
  
      self.set_encoder(encoder)
  
      self._pz_mu = nn.Parameter(
          torch.zeros(1, model_config.latent_dim), requires_grad=False
      )
      self._pz_logvar = nn.Parameter(
          torch.zeros(1, 1), requires_grad=False
      )
  
file_path: benchmark_VAE/src/pythae/models/pvae/pvae_model.py
imports: import warnings
  from typing import Optional
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ...data.datasets import BaseDataset
  from ..base.base_utils import ModelOutput
  from ..nn import BaseDecoder, BaseEncoder
  from ..nn.default_architectures import Encoder_SVAE_MLP, Encoder_VAE_MLP
  from ..vae import VAE
  from .pvae_config import PoincareVAEConfig
  from .pvae_utils import PoincareBall, RiemannianNormal, WrappedNormal
label_desc: Use image node_id 1 to create a new PoincareVAE object from inherited base classes: VAE with example: obj = PoincareVAE(model_config, encoder, decoder)