





from typing import Dict, List, Optional, Union

import numpy as np

from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format
from ...image_utils import (
    IMAGENET_STANDARD_MEAN,
    IMAGENET_STANDARD_STD,
    ChannelDimension,
    ImageInput,
    PILImageResampling,
    make_list_of_images,
    to_numpy_array,
    valid_images,
)
from ...utils import TensorType, is_vision_available, logging


if is_vision_available():
    import PIL


__lowerCamelCase :  Optional[Any]										=  logging.get_logger(__name__)



class       A__     ( a__    ):
      _UpperCAmelCase			:Any							=     ["pixel_values"]





      def __init__(				self ,							A_ = True ,							A_ = None ,							A_ = PIL.Image.BICUBIC ,							A_ = True ,							A_ = None ,							A_ = 1 / 255 ,							A_ = True ,							A_ = True ,							A_ = None ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       super().__init__(**lowerCamelCase_     )
       UpperCamelCase			:      List[str] 			=     size if size is not None else {"height": 256, "width": 256}
       UpperCamelCase			:      Optional[Any] 			=     get_size_dict(lowerCamelCase_     )
       UpperCamelCase			:      Tuple 			=     crop_size if crop_size is not None else {"height": 224, "width": 224}
       UpperCamelCase			:      Optional[int] 			=     get_size_dict(lowerCamelCase_ ,							param_name="crop_size"     )

       UpperCamelCase			:      int 			=     do_resize
       UpperCamelCase			:      Tuple 			=     size
       UpperCamelCase			:      Optional[int] 			=     resample
       UpperCamelCase			:      List[str] 			=     do_center_crop
       UpperCamelCase			:      Union[str, Any] 			=     crop_size
       UpperCamelCase			:      Dict 			=     do_rescale
       UpperCamelCase			:      int 			=     rescale_factor
       UpperCamelCase			:      str 			=     do_normalize
       UpperCamelCase			:      Tuple 			=     image_mean if image_mean is not None else IMAGENET_STANDARD_MEAN
       UpperCamelCase			:      Dict 			=     image_std if image_std is not None else IMAGENET_STANDARD_STD





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_ = PIL.Image.BICUBIC ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       UpperCamelCase			:      Any 			=     get_size_dict(lowerCamelCase_     )
       if "height" not in size or "width" not in size:
        raise ValueError(F"""The size dictionary must have keys 'height' and 'width'. Got {size.keys()}"""     )
       return resize(
           lowerCamelCase_ ,							size=(size["height"], size["width"]) ,							resample=lowerCamelCase_ ,							data_format=lowerCamelCase_ ,							**lowerCamelCase_     )





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       UpperCamelCase			:      Union[str, Any] 			=     get_size_dict(lowerCamelCase_     )
       if "height" not in size or "width" not in size:
        raise ValueError(F"""The size dictionary must have keys 'height' and 'width'. Got {size.keys()}"""     )
       return center_crop(lowerCamelCase_ ,							size=(size["height"], size["width"]) ,							data_format=lowerCamelCase_ ,							**lowerCamelCase_     )





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       return rescale(lowerCamelCase_ ,							scale=lowerCamelCase_ ,							data_format=lowerCamelCase_ ,							**lowerCamelCase_     )





      def  __UpperCamelCase(				self ,							A_ ,							A_ ,							A_ ,							A_ = None ,							**A_ ,							):
       '''simple docstring'''




       return normalize(lowerCamelCase_ ,							mean=lowerCamelCase_ ,							std=lowerCamelCase_ ,							data_format=lowerCamelCase_ ,							**lowerCamelCase_     )





      def  __UpperCamelCase(				self ,							A_ ,							A_ = None ,							A_ = None ,							A_=None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = ChannelDimension.FIRST ,							**A_ ,							):
       '''simple docstring'''




       UpperCamelCase			:      List[str] 			=     do_resize if do_resize is not None else self.do_resize
       UpperCamelCase			:      Optional[Any] 			=     resample if resample is not None else self.resample
       UpperCamelCase			:      Union[str, Any] 			=     do_center_crop if do_center_crop is not None else self.do_center_crop
       UpperCamelCase			:      List[str] 			=     do_rescale if do_rescale is not None else self.do_rescale
       UpperCamelCase			:      int 			=     rescale_factor if rescale_factor is not None else self.rescale_factor
       UpperCamelCase			:      Optional[Any] 			=     do_normalize if do_normalize is not None else self.do_normalize
       UpperCamelCase			:      str 			=     image_mean if image_mean is not None else self.image_mean
       UpperCamelCase			:      List[str] 			=     image_std if image_std is not None else self.image_std

       UpperCamelCase			:      Tuple 			=     size if size is not None else self.size
       UpperCamelCase			:      Any 			=     get_size_dict(lowerCamelCase_     )
       UpperCamelCase			:      Dict 			=     crop_size if crop_size is not None else self.crop_size
       UpperCamelCase			:      List[Any] 			=     get_size_dict(lowerCamelCase_ ,							param_name="crop_size"     )

       UpperCamelCase			:      Optional[Any] 			=     make_list_of_images(lowerCamelCase_     )

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

       if do_resize and size is None or resample is None:
        raise ValueError("Size and resample must be specified if do_resize is True."     )

       if do_center_crop and crop_size is None:
        raise ValueError("Crop size must be specified if do_center_crop is True."     )

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

       if do_normalize and (image_mean is None or image_std is None):
        raise ValueError("Image mean and std must be specified if do_normalize is True."     )

       # All transformations expect numpy arrays.
       UpperCamelCase			:      Any 			=     [to_numpy_array(lowerCamelCase_     ) for image in images]

       if do_resize:
        UpperCamelCase			:      List[str] 			=     [self.resize(image=lowerCamelCase_ ,							size=lowerCamelCase_ ,							resample=lowerCamelCase_     ) for image in images]

       if do_center_crop:
        UpperCamelCase			:      Optional[Any] 			=     [self.center_crop(image=lowerCamelCase_ ,							size=lowerCamelCase_     ) for image in images]

       if do_rescale:
        UpperCamelCase			:      Any 			=     [self.rescale(image=lowerCamelCase_ ,							scale=lowerCamelCase_     ) for image in images]

       if do_normalize:
        UpperCamelCase			:      Union[str, Any] 			=     [self.normalize(image=lowerCamelCase_ ,							mean=lowerCamelCase_ ,							std=lowerCamelCase_     ) for image in images]

       UpperCamelCase			:      Optional[int] 			=     [to_channel_dimension_format(lowerCamelCase_ ,							lowerCamelCase_     ) for image in images]

       UpperCamelCase			:      Optional[Any] 			=     {"pixel_values": images}
       return BatchFeature(data=lowerCamelCase_ ,							tensor_type=lowerCamelCase_     )









def 	A_       (  _lowerCAmelCase							,     _lowerCAmelCase  )		->				int:
 return int(input_a == input_a == 0  )



def 	A_       (  )		->				None:
 print("Truth Table of NOR Gate:"  )
 print("|   Input 1   |  Input 2  | Output |"  )
 print(F"""|      0      |    0      |  {nor_gate(0							,     0  )}     |"""  )
 print(F"""|      0      |    1      |  {nor_gate(0							,     1  )}     |"""  )
 print(F"""|      1      |    0      |  {nor_gate(1							,     0  )}     |"""  )
 print(F"""|      1      |    1      |  {nor_gate(1							,     1  )}     |"""  )


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    main()
