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 method converts a set of ``torch.Tensor`` to a
  :class:`~pythae.data.datasets.BaseDataset`
  
  Args:
      data (torch.Tensor): The set of data as a big torch.Tensor
      labels (torch.Tensor): The targets labels as a big torch.Tensor
  
  Returns:
      (BaseDataset): The resulting dataset
docstr_tok: ["This","method","converts","a","set","of","``","torch.Tensor","``","to","a",":","class",":","`","~pythae.data.datasets.BaseDataset","`","Args",":","data","(","torch.Tensor",")",":","The","set","of","data","as","a","big","torch.Tensor","labels","(","torch.Tensor",")",":","The","targets","labels","as","a","big","torch.Tensor","Returns",":","(","BaseDataset",")",":","The","resulting","dataset"]
code: def to_dataset(
      data: torch.Tensor, labels: Optional[torch.Tensor] = None
  ):
      """This method converts a set of ``torch.Tensor`` to a
      :class:`~pythae.data.datasets.BaseDataset`
  
      Args:
          data (torch.Tensor): The set of data as a big torch.Tensor
          labels (torch.Tensor): The targets labels as a big torch.Tensor
  
      Returns:
          (BaseDataset): The resulting dataset
      """
  
      if labels is None:
          labels = torch.ones(data.shape[0])
  
      labels = DataProcessor.to_tensor(labels)
      dataset = BaseDataset(data, labels)
  
      return dataset
  
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 3 for calling the DataProcessor obj's underlying member method code with example usage: obj.to_dataset(data, labels) and returns: dataset