class_docstr: This module defines a base class for EoT in PyTorch.
docstr: Apply transformations to inputs `x` and labels `y`.
  
  :param x: Input samples.
  :param y: Label of the samples `x`.
  :return: Transformed samples and labels.
code: def forward(
      self,
      x: "torch.Tensor",
      y: Optional[
          Union["torch.Tensor", List[Dict[str, "torch.Tensor"]]]
      ] = None,
  ) -> Tuple[
      "torch.Tensor",
      Optional[Union["torch.Tensor", List[Dict[str, "torch.Tensor"]]]],
  ]:
      """
      Apply transformations to inputs `x` and labels `y`.
  
      :param x: Input samples.
      :param y: Label of the samples `x`.
      :return: Transformed samples and labels.
      """
      import torch
  
      x_preprocess_list = []
      y_preprocess_list_classification: List[torch.Tensor] = []
      y_preprocess_list_object_detection: List[
          List[Dict[str, torch.Tensor]]
      ] = []
  
      for i_image in range(x.shape[0]):
          for _ in range(self.nb_samples):
              x_i = x[[i_image]]
              y_i: Optional[
                  Union[torch.Tensor, List[Dict[str, torch.Tensor]]]
              ]
              if y is not None:
                  if isinstance(y, list):
                      y_i = [y[i_image]]
                  else:
                      y_i = y[[i_image]]
              else:
                  y_i = None
              x_preprocess, y_preprocess_i = self._transform(x_i, y_i)
              x_preprocess_list.append(
                  torch.squeeze(x_preprocess, dim=0)
              )
  
              if y is not None and y_preprocess_i is not None:
                  if isinstance(y_preprocess_i, torch.Tensor):
                      y_preprocess_list_classification.append(
                          torch.squeeze(y_preprocess_i, dim=0)
                      )
                  else:
                      y_preprocess_list_object_detection.append(
                          y_preprocess_i
                      )
  
      x_preprocess = torch.stack(x_preprocess_list, dim=0)
      y_preprocess: Optional[
          Union["torch.Tensor", List[Dict[str, "torch.Tensor"]]]
      ]
      if y is None:
          y_preprocess = y
      else:
          if isinstance(y, torch.Tensor):
              y_preprocess = torch.stack(
                  y_preprocess_list_classification, dim=0
              )
          else:
              y_preprocess = [
                  item
                  for sublist in y_preprocess_list_object_detection
                  for item in sublist
              ]
  
      return x_preprocess, y_preprocess
  
file_path: adversarial-robustness-toolbox/art/preprocessing/expectation_over_transformation/pytorch.py
imports: from abc import abstractmethod
  import logging
  from typing import Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  from art.preprocessing.preprocessing import PreprocessorPyTorch
label_desc: Use image node_id 3 for calling the EoTPyTorch obj's underlying member method code with example usage: obj.forward(x, y) and returns: x_preprocess,  y_preprocess