class_docstr: Base class for samplers used to generate from the VAEs models.
  
  Args:
      model (BaseAE): The vae model to sample from.
      sampler_config (BaseSamplerConfig): An instance of BaseSamplerConfig in which any sampler's
          parameters is made available. If None a default configuration is used. Default: None
class_docstr_tok: ["Base","class","for","samplers","used","to","generate","from","the","VAEs","models",".","Args",":","model","(","BaseAE",")",":","The","vae","model","to","sample","from",".","sampler_config","(","BaseSamplerConfig",")",":","An","instance","of","BaseSamplerConfig","in","which","any","sampler's","parameters","is","made","available",".","If","None","a","default","configuration","is","used",".","Default",":","None"]
docstr: Main sampling function of the sampler.
  
  Args:
      num_samples (int): The number of samples to generate
      batch_size (int): The batch size to use during sampling
      output_dir (str): The directory where the images will be saved. If does not exist the
          folder is created. If None: the images are not saved. Defaults: None.
      return_gen (bool): Whether the sampler should directly return a tensor of generated
          data. Default: True.
  
  Returns:
      ~torch.Tensor: The generated images
docstr_tok: ["Main","sampling","function","of","the","sampler",".","Args",":","num_samples","(","int",")",":","The","number","of","samples","to","generate","batch_size","(","int",")",":","The","batch","size","to","use","during","sampling","output_dir","(","str",")",":","The","directory","where","the","images","will","be","saved",".","If","does","not","exist","the","folder","is","created",".","If","None",":","the","images","are","not","saved",".","Defaults",":","None",".","return_gen","(","bool",")",":","Whether","the","sampler","should","directly","return","a","tensor","of","generated","data",".","Default",":","True",".","Returns",":","~torch.Tensor",":","The","generated","images"]
code: def sample(
      self,
      num_samples: int = 1,
      batch_size: int = 500,
      output_dir: str = None,
      return_gen: bool = True,
  ):
      """Main sampling function of the sampler.
  
      Args:
          num_samples (int): The number of samples to generate
          batch_size (int): The batch size to use during sampling
          output_dir (str): The directory where the images will be saved. If does not exist the
              folder is created. If None: the images are not saved. Defaults: None.
          return_gen (bool): Whether the sampler should directly return a tensor of generated
              data. Default: True.
  
      Returns:
          ~torch.Tensor: The generated images
      """
      raise NotImplementedError()
  
file_path: benchmark_VAE/src/pythae/samplers/base/base_sampler.py
imports: import logging
  import os
  from typing import Any, Dict
  import numpy
  import torch
  from imageio import imwrite
  from ...models import BaseAE
  from .base_sampler_config import BaseSamplerConfig
label_desc: Use image node_id 3 for calling the BaseSampler obj's underlying member method code with example usage: obj.sample(num_samples, batch_size, output_dir, return_gen) without return types