class_docstr: This module defines a base class for EoT in TensorFlow v2.
class_docstr_tok: ["This","module","defines","a","base","class","for","EoT","in","TensorFlow","v2","."]
docstr: Apply transformations to inputs `x` and labels `y`.
  
  :param x: Input samples.
  :param y: Label of the sample `x`. This function does not modify `y`.
  :return: Corrupted samples and labels.
docstr_tok: ["Apply","transformations","to","inputs","`","x","`","and","labels","`","y","`",".",":","param","x",":","Input","samples",".",":","param","y",":","Label","of","the","sample","`","x","`",".","This","function","does","not","modify","`","y","`",".",":","return",":","Corrupted","samples","and","labels","."]
code: def forward(
      self, x: "tf.Tensor", y: Optional["tf.Tensor"] = None
  ) -> Tuple["tf.Tensor", Optional["tf.Tensor"]]:
      """
      Apply transformations to inputs `x` and labels `y`.
  
      :param x: Input samples.
      :param y: Label of the sample `x`. This function does not modify `y`.
      :return: Corrupted samples and labels.
      """
      import tensorflow as tf
  
      x_preprocess_list = []
      y_preprocess_list = []
  
      for i_image in range(x.shape[0]):
          for _ in range(self.nb_samples):
              x_i = x[[i_image]]
              y_i: Optional[
                  Union[tf.Tensor, List[Dict[str, tf.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(tf.squeeze(x_preprocess, axis=0))
  
              if y is not None and y_preprocess_i is not None:
                  y_preprocess_list.append(y_preprocess_i)
  
      x_preprocess = tf.stack(x_preprocess_list, axis=0)
      if y is None:
          y_preprocess = y
      else:
          if isinstance(y, (tf.Tensor, np.ndarray)):
              y_preprocess = tf.stack(y_preprocess_list, axis=0)
          else:
              y_preprocess = [
                  item
                  for sublist in y_preprocess_list
                  for item in sublist
              ]
  
      return x_preprocess, y_preprocess
  
file_path: adversarial-robustness-toolbox/art/preprocessing/expectation_over_transformation/tensorflow.py
imports: from abc import abstractmethod
  import logging
  from typing import Dict, List, Optional, Tuple, TYPE_CHECKING, Union
  import numpy
  from art.preprocessing.preprocessing import PreprocessorTensorFlowV2
label_desc: Use image node_id 3 for calling the EoTTensorFlowV2 obj's underlying member method code with example usage: obj.forward(x, y) and returns: x_preprocess,  y_preprocess