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: Saves a data point as .png file in dir_path with img_name as name.
  
  Args:
      img_tensor (torch.Tensor): The image of shape CxHxW in the range [0-1]
      dir_path (str): The folder where in which the images must be saved
      ig_name (str): The name to apply to the file containing the image.
docstr_tok: ["Saves","a","data","point","as",".png","file","in","dir_path","with","img_name","as","name",".","Args",":","img_tensor","(","torch.Tensor",")",":","The","image","of","shape","CxHxW","in","the","range","[","0-1","]","dir_path","(","str",")",":","The","folder","where","in","which","the","images","must","be","saved","ig_name","(","str",")",":","The","name","to","apply","to","the","file","containing","the","image","."]
code: def save_img(
      self, img_tensor: torch.Tensor, dir_path: str, img_name: str
  ):
      """Saves a data point as .png file in dir_path with img_name as name.
  
      Args:
          img_tensor (torch.Tensor): The image of shape CxHxW in the range [0-1]
          dir_path (str): The folder where in which the images must be saved
          ig_name (str): The name to apply to the file containing the image.
      """
  
      if not os.path.exists(dir_path):
          os.makedirs(dir_path)
          print(
              f"--> Created folder {dir_path}. Images will be saved here"
          )
  
      img = (
          255.0 * torch.movedim(img_tensor, 0, 2).cpu().detach().numpy()
      )
      if img.shape[-1] == 1:
          img = np.repeat(img, repeats=3, axis=-1)
  
      img = img.astype("uint8")
      imwrite(os.path.join(dir_path, f"{img_name}"), img)
  
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 5 for calling the BaseSampler obj's underlying member method code with example usage: obj.save_img(img_tensor, dir_path, img_name) without return types