


"""simple docstring"""




def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__      ,	SCREAMING_SNAKE_CASE__						):
 # "extended trapezoidal rule"
 # int(f) = dx/2 * (f1 + 2f2 + ... + fn)
 __lowerCamelCase		:							Optional[int]		 =						(boundary[1] - boundary[0]) / steps
 __lowerCamelCase		:							Any		 =						boundary[0]
 __lowerCamelCase		:							str		 =						boundary[1]
 __lowerCamelCase		:							List[str]		 =						make_points(__UpperCAmelCase      ,	__UpperCAmelCase      ,	__UpperCAmelCase						)
 __lowerCamelCase		:							Optional[Any]		 =						0.0
 y += (h / 2.0) * f(__UpperCAmelCase						)
 for i in x_i:
  # print(i)
  y += h * f(__UpperCAmelCase						)
 y += (h / 2.0) * f(__UpperCAmelCase						)
 return y
def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__      ,	SCREAMING_SNAKE_CASE__      ,	SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase		:							str		 =						a + h
 while x < (b - h):
  yield x
  __lowerCamelCase		:							Tuple		 =						x + h
def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__						):  # enter your function here
 __lowerCamelCase		:							List[Any]		 =						(x - 0) * (x - 0)
 return y
def 				UpperCamelCase__					(  ):
 __lowerCamelCase		:							List[Any]		 =						0.0  # Lower bound of integration
 __lowerCamelCase		:							List[Any]		 =						1.0  # Upper bound of integration
 __lowerCamelCase		:							int		 =						10.0  # define number of steps or resolution
 __lowerCamelCase		:							List[str]		 =						[a, b]  # define boundary of integration
 __lowerCamelCase		:							Dict		 =						method_a(__UpperCAmelCase      ,	__UpperCAmelCase						)
 print(f'y = {y}'						)


if __name__ == "__main__":
       main()





import copy
from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig


if TYPE_CHECKING:
       from ... import PreTrainedTokenizerBase, TensorType

lowercase_	   =     logging.get_logger(__name__)


class 	A_ (	__UpperCamelCase   ):




      '''simple docstring'''


      __snake_case 	=       """vision-encoder-decoder"""
      __snake_case 	=       True




      def __init__(    self:	Union[str, Any]						,				**a:	Optional[Any]    ):
       super().__init__(**a    )
       if "encoder" not in kwargs or "decoder" not in kwargs:
        raise ValueError(
            F'A configuraton of type {self.model_type} cannot be instantiated because '
            F'not both `encoder` and `decoder` sub-configurations are passed, but only {kwargs}'    )

       __lowerCamelCase		:							Dict		 =						kwargs.pop('encoder'    )
       __lowerCamelCase		:							int		 =						encoder_config.pop('model_type'    )
       __lowerCamelCase		:							Any		 =						kwargs.pop('decoder'    )
       __lowerCamelCase		:							Union[str, Any]		 =						decoder_config.pop('model_type'    )

       __lowerCamelCase		:							Optional[Any]		 =						AutoConfig.for_model(a						,				**a    )
       __lowerCamelCase		:							List[Any]		 =						AutoConfig.for_model(a						,				**a    )
       __lowerCamelCase		:							Tuple		 =						True




      @classmethod
      def 					_snake_case     (    cls:	Optional[Any]						,				a:	PretrainedConfig						,				a:	PretrainedConfig						,				**a:	Dict    ):
       logger.info('Setting `config.is_decoder=True` and `config.add_cross_attention=True` for decoder_config'    )
       __lowerCamelCase		:							Optional[Any]		 =						True
       __lowerCamelCase		:							Optional[Any]		 =						True

       return cls(encoder=encoder_config.to_dict()						,				decoder=decoder_config.to_dict()						,				**a    )




      def 					_snake_case     (    self:	str    ):
       __lowerCamelCase		:							int		 =						copy.deepcopy(self.__dict__    )
       __lowerCamelCase		:							Dict		 =						self.encoder.to_dict()
       __lowerCamelCase		:							Union[str, Any]		 =						self.decoder.to_dict()
       __lowerCamelCase		:							Optional[int]		 =						self.__class__.model_type
       return output



class 	A_ (	__UpperCamelCase   ):




      '''simple docstring'''


      __snake_case 	=       version.parse("""1.11"""   )




      @property
      def 					_snake_case     (    self:	Union[str, Any]    ):
       return OrderedDict(
           [
               ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
           ]    )




      @property
      def 					_snake_case     (    self:	Optional[Any]    ):
       return 1e-4




      @property
      def 					_snake_case     (    self:	List[str]    ):
       return OrderedDict({'last_hidden_state': {0: 'batch', 1: 'encoder_sequence'}}    )



class 	A_ (	__UpperCamelCase   ):




      '''simple docstring'''


      @property
      def 					_snake_case     (    self:	Tuple    ):
       __lowerCamelCase		:							Union[str, Any]		 =						OrderedDict()
       __lowerCamelCase		:							Union[str, Any]		 =						{0: 'batch', 1: 'past_decoder_sequence + sequence'}
       __lowerCamelCase		:							Optional[Any]		 =						{0: 'batch', 1: 'past_decoder_sequence + sequence'}
       __lowerCamelCase		:							Dict		 =						{0: 'batch', 1: 'encoder_sequence'}

       return common_inputs




      def 					_snake_case     (    self:	List[Any]						,				a:	"PreTrainedTokenizerBase"						,				a:	int = -1						,				a:	int = -1						,				a:	bool = False						,				a:	Optional["TensorType"] = None						,				):
       import torch

       __lowerCamelCase		:							str		 =						OrderedDict()

       __lowerCamelCase		:							List[Any]		 =						super().generate_dummy_inputs(
           a						,				batch_size=a						,				seq_length=a						,				is_pair=a						,				framework=a    )

       __lowerCamelCase ,					__lowerCamelCase		:							Dict		 =						dummy_input['input_ids'].shape
       __lowerCamelCase		:							str		 =						(batch, encoder_sequence, self._config.encoder_hidden_size)
       __lowerCamelCase		:							str		 =						dummy_input.pop('input_ids'    )
       __lowerCamelCase		:							Union[str, Any]		 =						dummy_input.pop('attention_mask'    )
       __lowerCamelCase		:							str		 =						torch.zeros(a    )

       return common_inputs



class 	A_ (	__UpperCamelCase   ):




      '''simple docstring'''


      @property
      def 					_snake_case     (    self:	List[Any]    ):
       pass




      def 					_snake_case     (    self:	List[str]						,				a:	PretrainedConfig    ):
       return VisionEncoderDecoderEncoderOnnxConfig(a    )




      def 					_snake_case     (    self:	Optional[int]						,				a:	PretrainedConfig						,				a:	PretrainedConfig						,				a:	str = "default"    ):
       __lowerCamelCase		:							List[Any]		 =						encoder_config.hidden_size
       return VisionEncoderDecoderDecoderOnnxConfig(a						,				a    )

