


"""simple docstring"""
from typing import Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature
from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format
from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_images
from ...utils import TensorType, logging


UpperCAmelCase				=						logging.get_logger(__name__)




class 	lowercase__				(					A_				):
   __UpperCAmelCase							       =					['''pixel_values''']





   def __init__(							self      ,   SCREAMING_SNAKE_CASE = True      ,   SCREAMING_SNAKE_CASE = 1 / 255      ,   SCREAMING_SNAKE_CASE = True      ,   SCREAMING_SNAKE_CASE = 8      ,   **SCREAMING_SNAKE_CASE      ,   )  ->  None:
      super().__init__(**SCREAMING_SNAKE_CASE)

      _lowerCamelCase	:					Optional[int]   =		do_rescale
      _lowerCamelCase	:					Optional[Any]   =		rescale_factor
      _lowerCamelCase	:					Any   =		do_pad
      _lowerCamelCase	:					Tuple   =		pad_size





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE = None      ,   **SCREAMING_SNAKE_CASE)  ->  np.ndarray:
      return rescale(SCREAMING_SNAKE_CASE      ,   scale=SCREAMING_SNAKE_CASE      ,   data_format=SCREAMING_SNAKE_CASE      ,   **SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE = None)  ->  List[Any]:
      _lowerCamelCase   ,    _lowerCamelCase	:					str   =		get_image_size(SCREAMING_SNAKE_CASE)
      _lowerCamelCase	:					Tuple   =		(old_height // size + 1) * size - old_height
      _lowerCamelCase	:					Any   =		(old_width // size + 1) * size - old_width

      return pad(SCREAMING_SNAKE_CASE      ,   ((0, pad_height), (0, pad_width))      ,   mode="""symmetric"""      ,   data_format=SCREAMING_SNAKE_CASE)





   def 		UpperCamelCase_  (							self      ,   SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = None      ,   SCREAMING_SNAKE_CASE = ChannelDimension.FIRST      ,   **SCREAMING_SNAKE_CASE      ,   )  ->  Dict:
      _lowerCamelCase	:					Optional[Any]   =		do_rescale if do_rescale is not None else self.do_rescale
      _lowerCamelCase	:					Union[str, Any]   =		rescale_factor if rescale_factor is not None else self.rescale_factor
      _lowerCamelCase	:					Optional[int]   =		do_pad if do_pad is not None else self.do_pad
      _lowerCamelCase	:					Any   =		pad_size if pad_size is not None else self.pad_size

      _lowerCamelCase	:					List[str]   =		make_list_of_images(SCREAMING_SNAKE_CASE)

      if not valid_images(SCREAMING_SNAKE_CASE):
         raise ValueError(
             """Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, """
             """torch.Tensor, tf.Tensor or jax.ndarray.""")

      if do_rescale and rescale_factor is None:
         raise ValueError("""Rescale factor must be specified if do_rescale is True.""")

      # All transformations expect numpy arrays.
      _lowerCamelCase	:					List[Any]   =		[to_numpy_array(SCREAMING_SNAKE_CASE) for image in images]

      if do_rescale:
         _lowerCamelCase	:					Dict   =		[self.rescale(image=SCREAMING_SNAKE_CASE      ,   scale=SCREAMING_SNAKE_CASE) for image in images]

      if do_pad:
         _lowerCamelCase	:					Optional[int]   =		[self.pad(SCREAMING_SNAKE_CASE      ,   size=SCREAMING_SNAKE_CASE) for image in images]

      _lowerCamelCase	:					List[Any]   =		[to_channel_dimension_format(SCREAMING_SNAKE_CASE      ,   SCREAMING_SNAKE_CASE) for image in images]

      _lowerCamelCase	:					Dict   =		{"""pixel_values""": images}
      return BatchFeature(data=SCREAMING_SNAKE_CASE      ,   tensor_type=SCREAMING_SNAKE_CASE)



"""simple docstring"""



def 					lowerCamelCase   (     _snake_case    ,_snake_case ):
    return int((input_a, input_a).count(0 ) == 0 )
def 					lowerCamelCase   (     ):
    assert and_gate(0    ,0 ) == 0
    assert and_gate(0    ,1 ) == 0
    assert and_gate(1    ,0 ) == 0
    assert and_gate(1    ,1 ) == 1


if __name__ == "__main__":
    test_and_gate()
    print(and_gate(1, 0))
    print(and_gate(0, 0))
    print(and_gate(0, 1))
    print(and_gate(1, 1))

