class_docstr: FactorVAE model.
  
  Args:
      model_config (FactorVAEConfig): The 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: ["FactorVAE","model",".","Args",":","model_config","(","FactorVAEConfig",")",":","The","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 method is called to set the discriminator network
  
  Args:
      discriminator (BaseDiscriminator): The discriminator module that needs to be set to the model.
docstr_tok: ["This","method","is","called","to","set","the","discriminator","network","Args",":","discriminator","(","BaseDiscriminator",")",":","The","discriminator","module","that","needs","to","be","set","to","the","model","."]
code: def set_discriminator(self, discriminator: BaseDiscriminator) -> None:
      r"""This method is called to set the discriminator network
  
      Args:
          discriminator (BaseDiscriminator): The discriminator module that needs to be set to the model.
  
      """
      if not issubclass(type(discriminator), BaseDiscriminator):
          raise BadInheritanceError(
              (
                  "Discriminator must inherit from BaseDiscriminator class from "
                  "pythae.models.base_architectures.BaseDiscriminator. Refer to documentation."
              )
          )
  
      self.discriminator = discriminator
  
imports: import os
  from typing import Optional
  import torch
  import torch.nn.functional
  from ...customexception import BadInheritanceError
  from ...data.datasets import BaseDataset
  from ..base.base_utils import ModelOutput
  from ..nn import BaseDecoder, BaseDiscriminator, BaseEncoder
  from ..vae import VAE
  from .factor_vae_config import FactorVAEConfig
  from .factor_vae_utils import FactorVAEDiscriminator
label_desc: Use image node_id 2 for calling the FactorVAE obj's underlying member method code with example usage: obj.set_discriminator(discriminator) without return types