class_docstr: This module implements EoT of zoom blur with uniformly sampled zoom factor.
docstr: Transformation of an image with randomly sampled zoom blur.
  
  :param x: Input samples.
  :param y: Label of the samples `x`.
  :return: Transformed samples and labels.
code: def _transform(
      self, x: "tf.Tensor", y: Optional["tf.Tensor"], **kwargs
  ) -> Tuple["tf.Tensor", Optional["tf.Tensor"]]:
      """
      Transformation of an image with randomly sampled zoom blur.
  
      :param x: Input samples.
      :param y: Label of the samples `x`.
      :return: Transformed samples and labels.
      """
      import tensorflow as tf
  
      nb_zooms = 10
      x_blur = tf.zeros_like(x)
      max_zoom_i = np.random.uniform(
          low=self.zoom_range[0], high=self.zoom_range[1]
      )
      zooms = np.arange(
          start=1.0, stop=max_zoom_i, step=(max_zoom_i - 1.0) / nb_zooms
      )
  
      height = x.shape[1]
      width = x.shape[2]
  
      for zoom in zooms:
          size = [int(a * zoom) for a in x.shape[1:3]]
          x_resized = tf.image.resize(
              images=x,
              size=size,
              method=tf.image.ResizeMethod.BILINEAR,
              preserve_aspect_ratio=True,
              antialias=False,
              name=None,
          )
  
          trim_top = (x_resized.shape[1] - height) // 2
          trim_left = (x_resized.shape[2] - width) // 2
  
          x_blur += x_resized[
              0:1,
              trim_top : trim_top + height,
              trim_left : trim_left + width,
              :,
          ]
  
      x_out = (x + x_blur) / (nb_zooms + 1)
      return (
          tf.clip_by_value(
              x_out,
              clip_value_min=self.clip_values[0],
              clip_value_max=self.clip_values[1],
          ),
          y,
      )
  
file_path: adversarial-robustness-toolbox/art/preprocessing/expectation_over_transformation/natural_corruptions/zoom_blur/tensorflow.py
imports: import logging
  from typing import Tuple, Union, TYPE_CHECKING, Optional
  import numpy
  from art.preprocessing.expectation_over_transformation.tensorflow import EoTTensorFlowV2
label_desc: Use image node_id 2 for calling the EoTZoomBlurTensorFlow obj's underlying member method code with example usage: obj._transform(x, y) and returns: tf,  y