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","``","."]
docstr: This function performs a geodesic interpolation in the poincaré disk of the autoencoder
  from starting inputs to ending inputs. It returns the interpolation trajectories.
  
  Args:
      starting_inputs (torch.Tensor): The starting inputs in the interpolation of shape
          [B x input_dim]
      ending_inputs (torch.Tensor): The starting inputs in the interpolation of shape
          [B x input_dim]
      granularity (int): The granularity of the interpolation.
  
  Returns:
      torch.Tensor: A tensor of shape [B x granularity x input_dim] containing the
      interpolation trajectories.
docstr_tok: ["This","function","performs","a","geodesic","interpolation","in","the","poincar\u00e9","disk","of","the","autoencoder","from","starting","inputs","to","ending","inputs",".","It","returns","the","interpolation","trajectories",".","Args",":","starting_inputs","(","torch.Tensor",")",":","The","starting","inputs","in","the","interpolation","of","shape","[","B","x","input_dim","]","ending_inputs","(","torch.Tensor",")",":","The","starting","inputs","in","the","interpolation","of","shape","[","B","x","input_dim","]","granularity","(","int",")",":","The","granularity","of","the","interpolation",".","Returns",":","torch.Tensor",":","A","tensor","of","shape","[","B","x","granularity","x","input_dim","]","containing","the","interpolation","trajectories","."]
code: def interpolate(
      self,
      starting_inputs: torch.Tensor,
      ending_inputs: torch.Tensor,
      granularity: int = 10,
  ):
      """This function performs a geodesic interpolation in the poincaré disk of the autoencoder
      from starting inputs to ending inputs. It returns the interpolation trajectories.
  
      Args:
          starting_inputs (torch.Tensor): The starting inputs in the interpolation of shape
              [B x input_dim]
          ending_inputs (torch.Tensor): The starting inputs in the interpolation of shape
              [B x input_dim]
          granularity (int): The granularity of the interpolation.
  
      Returns:
          torch.Tensor: A tensor of shape [B x granularity x input_dim] containing the
          interpolation trajectories.
      """
      assert starting_inputs.shape[0] == ending_inputs.shape[0], (
          "The number of starting_inputs should equal the number of ending_inputs. Got "
          f"{starting_inputs.shape[0]} sampler for starting_inputs and {ending_inputs.shape[0]} "
          "for endinging_inputs."
      )
  
      starting_z = self.encoder(starting_inputs).embedding
      ending_z = self.encoder(ending_inputs).embedding
      t = torch.linspace(0, 1, granularity).to(starting_inputs.device)
  
      inter_geo = torch.zeros(
          starting_inputs.shape[0], granularity, starting_z.shape[-1]
      ).to(starting_z.device)
  
      for i, t_i in enumerate(t):
          z_i = self.latent_manifold.geodesic(t_i, starting_z, ending_z)
          inter_geo[:, i, :] = z_i
  
      decoded_geo = self.decoder(
          inter_geo.reshape(
              (starting_z.shape[0] * t.shape[0],)
              + (starting_z.shape[1:])
          )
      ).reconstruction.reshape(
          (
              starting_inputs.shape[0],
              t.shape[0],
          )
          + (starting_inputs.shape[1:])
      )
      return decoded_geo
  
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 4 for calling the PoincareVAE obj's underlying member method code with example usage: obj.interpolate(starting_inputs, ending_inputs, granularity) and returns: decoded_geo