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","*","*","."]
code: def _process_data_array(
      self, data: np.ndarray, batch_size: int = 100
  ):
      num_samples = data.shape[0]
      samples_shape = data.shape
  
      num_complete_batch = num_samples // batch_size
      num_in_last = num_samples % batch_size
  
      full_data = []
  
      for i in range(num_complete_batch):
          # Detect potential nan
          if DataProcessor.has_nan(
              data[i * batch_size : (i + 1) * batch_size]
          ):
              raise ValueError("Nan detected in input data!")
  
          processed_data = DataProcessor.to_tensor(
              data[i * batch_size : (i + 1) * batch_size]
          )
          full_data.append(processed_data)
  
      if num_in_last > 0:
          # Detect potential nan
          if DataProcessor.has_nan(data[-num_in_last:]):
              raise ValueError("Nan detected in input data!")
  
          processed_data = DataProcessor.to_tensor(data[-num_in_last:])
          full_data.append(processed_data)
  
      processed_data = torch.cat(full_data)
  
      assert processed_data.shape == samples_shape, (
          data.shape,
          num_samples,
      )
  
      return processed_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 4 for calling the DataProcessor obj's underlying member method code with example usage: obj._process_data_array(data, batch_size) and returns: processed_data