class_docstr: This is a basic class which preprocesses the data.
  Basically, it takes messy data, detects potential nan, bad types end convert the
  data to a type handled by the VAE models (*i.e.* `torch.Tensor`). Moreover, if the
  data does not have the same shape, a reshaping is applied and data is resized to the
  **minimal shape**.
class_docstr_tok: ["This","is","a","basic","class","which","preprocesses","the","data",".","Basically",",","it","takes","messy","data",",","detects","potential","nan",",","bad","types","end","convert","the","data","to","a","type","handled","by","the","VAE","models","(","*","i.e",".","*","`","torch.Tensor","`",")",".","Moreover",",","if","the","data","does","not","have","the","same","shape",",","a","reshaping","is","applied","and","data","is","resized","to","the","*","*","minimal","shape","*","*","."]
docstr: This function detects potential check the data type, detects nan in input data and
  preprocessed the data so it can be handled by the models.
  
  Args:
      data (Union[np.ndarray, torch.Tensor]): The data that need to be
          checked. Expected:
  
              - | np.ndarray of shape `num_data x n_channels x [optional depth] x
                | [optional height] x width x ...`
              - | torch.Tensor of shape `num_data x n_channels x [optional depth] x
                | [optional height] x width x ...`
  
      batch_size (int): The batch size used for data preprocessing
  
  Returns:
      clean_data (torch.tensor): The data that has been cleaned
docstr_tok: ["This","function","detects","potential","check","the","data","type",",","detects","nan","in","input","data","and","preprocessed","the","data","so","it","can","be","handled","by","the","models",".","Args",":","data","(","Union","[","np.ndarray",",","torch.Tensor","]",")",":","The","data","that","need","to","be","checked",".","Expected",":","-","|","np.ndarray","of","shape","`","num_data","x","n_channels","x","[","optional","depth","]","x","|","[","optional","height","]","x","width","x","...","`","-","|","torch.Tensor","of","shape","`","num_data","x","n_channels","x","[","optional","depth","]","x","|","[","optional","height","]","x","width","x","...","`","batch_size","(","int",")",":","The","batch","size","used","for","data","preprocessing","Returns",":","clean_data","(","torch.tensor",")",":","The","data","that","has","been","cleaned"]
code: def process_data(
      self, data: Union[np.ndarray, torch.Tensor], batch_size: int = 100
  ) -> torch.Tensor:
      """This function detects potential check the data type, detects nan in input data and
      preprocessed the data so it can be handled by the models.
  
      Args:
          data (Union[np.ndarray, torch.Tensor]): The data that need to be
              checked. Expected:
  
                  - | np.ndarray of shape `num_data x n_channels x [optional depth] x
                    | [optional height] x width x ...`
                  - | torch.Tensor of shape `num_data x n_channels x [optional depth] x
                    | [optional height] x width x ...`
  
          batch_size (int): The batch size used for data preprocessing
  
      Returns:
          clean_data (torch.tensor): The data that has been cleaned
      """
  
      if isinstance(data, np.ndarray) or torch.is_tensor(data):
          data = self._process_data_array(data, batch_size=batch_size)
  
      else:
          raise TypeError(
              "Wrong data type provided. Expected one of "
              "[np.ndarray, torch.Tensor]"
          )
  
      return data
  
file_path: benchmark_VAE/src/pythae/data/preprocessors.py
imports: import logging
  from typing import Optional, Union
  import numpy
  import torch
  from typing_extensions import Literal
  from pythae.data.datasets import BaseDataset
label_desc: Use image node_id 2 for calling the DataProcessor obj's underlying member method code with example usage: obj.process_data(data, batch_size) and returns: data