
'''simple docstring'''



from __future__ import annotations

import copy
import inspect
import unittest

import numpy as np

from transformers import is_tf_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_tf, slow
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
     import tensorflow as tf

     from transformers import (
         TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST,
         TF_MODEL_FOR_MULTIPLE_CHOICE_MAPPING,
         TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
         TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
         TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
         LayoutLMvaConfig,
         TFLayoutLMvaForQuestionAnswering,
         TFLayoutLMvaForSequenceClassification,
         TFLayoutLMvaForTokenClassification,
         TFLayoutLMvaModel,
     )

if is_vision_available():
     from PIL import Image

     from transformers import LayoutLMvaImageProcessor

class    _a				:






       def __init__(							self       ,							A__       ,							A__=2       ,							A__=3       ,							A__=4       ,							A__=2       ,							A__=7       ,							A__=True       ,							A__=True       ,							A__=True       ,							A__=True       ,							A__=99       ,							A__=36       ,							A__=2       ,							A__=4       ,							A__=37       ,							A__="gelu"       ,							A__=0.1       ,							A__=0.1       ,							A__=5_12       ,							A__=16       ,							A__=2       ,							A__=0.02       ,							A__=6       ,							A__=6       ,							A__=3       ,							A__=4       ,							A__=None       ,							A__=10_00       ,							)    ->			List[str]:
          _SCREAMING_SNAKE_CASE      =				parent
          _SCREAMING_SNAKE_CASE      =				batch_size
          _SCREAMING_SNAKE_CASE      =				num_channels
          _SCREAMING_SNAKE_CASE      =				image_size
          _SCREAMING_SNAKE_CASE      =				patch_size
          _SCREAMING_SNAKE_CASE      =				is_training
          _SCREAMING_SNAKE_CASE      =				use_input_mask
          _SCREAMING_SNAKE_CASE      =				use_token_type_ids
          _SCREAMING_SNAKE_CASE      =				use_labels
          _SCREAMING_SNAKE_CASE      =				vocab_size
          _SCREAMING_SNAKE_CASE      =				hidden_size
          _SCREAMING_SNAKE_CASE      =				num_hidden_layers
          _SCREAMING_SNAKE_CASE      =				num_attention_heads
          _SCREAMING_SNAKE_CASE      =				intermediate_size
          _SCREAMING_SNAKE_CASE      =				hidden_act
          _SCREAMING_SNAKE_CASE      =				hidden_dropout_prob
          _SCREAMING_SNAKE_CASE      =				attention_probs_dropout_prob
          _SCREAMING_SNAKE_CASE      =				max_position_embeddings
          _SCREAMING_SNAKE_CASE      =				type_vocab_size
          _SCREAMING_SNAKE_CASE      =				type_sequence_label_size
          _SCREAMING_SNAKE_CASE      =				initializer_range
          _SCREAMING_SNAKE_CASE      =				coordinate_size
          _SCREAMING_SNAKE_CASE      =				shape_size
          _SCREAMING_SNAKE_CASE      =				num_labels
          _SCREAMING_SNAKE_CASE      =				num_choices
          _SCREAMING_SNAKE_CASE      =				scope
          _SCREAMING_SNAKE_CASE      =				range_bbox

          # LayoutLMv3's sequence length equals the number of text tokens + number of patches + 1 (we add 1 for the CLS token)
          _SCREAMING_SNAKE_CASE      =				text_seq_length
          _SCREAMING_SNAKE_CASE      =				(image_size // patch_size) ** 2 + 1
          _SCREAMING_SNAKE_CASE      =				self.text_seq_length + self.image_seq_length






       def        UpperCamelCase				(							self      )    ->			Optional[int]:
          _SCREAMING_SNAKE_CASE      =				ids_tensor([self.batch_size, self.text_seq_length]       ,							self.vocab_size      )

          _SCREAMING_SNAKE_CASE      =				ids_tensor([self.batch_size, self.text_seq_length, 4]       ,							self.range_bbox      )
          _SCREAMING_SNAKE_CASE      =				bbox.numpy()
          # Ensure that bbox is legal
          for i in range(bbox.shape[0]      ):
             for j in range(bbox.shape[1]      ):
                if bbox[i, j, 3] < bbox[i, j, 1]:
                   _SCREAMING_SNAKE_CASE      =				bbox[i, j, 3]
                   _SCREAMING_SNAKE_CASE      =				bbox[i, j, 1]
                   _SCREAMING_SNAKE_CASE      =				tmp_coordinate
                if bbox[i, j, 2] < bbox[i, j, 0]:
                   _SCREAMING_SNAKE_CASE      =				bbox[i, j, 2]
                   _SCREAMING_SNAKE_CASE      =				bbox[i, j, 0]
                   _SCREAMING_SNAKE_CASE      =				tmp_coordinate
          _SCREAMING_SNAKE_CASE      =				tf.constant(A__      )

          _SCREAMING_SNAKE_CASE      =				floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

          _SCREAMING_SNAKE_CASE      =				None
          if self.use_input_mask:
             _SCREAMING_SNAKE_CASE      =				random_attention_mask([self.batch_size, self.text_seq_length]      )

          _SCREAMING_SNAKE_CASE      =				None
          if self.use_token_type_ids:
             _SCREAMING_SNAKE_CASE      =				ids_tensor([self.batch_size, self.text_seq_length]       ,							self.type_vocab_size      )

          _SCREAMING_SNAKE_CASE      =				None
          _SCREAMING_SNAKE_CASE      =				None
          if self.use_labels:
             _SCREAMING_SNAKE_CASE      =				ids_tensor([self.batch_size]       ,							self.type_sequence_label_size      )
             _SCREAMING_SNAKE_CASE      =				ids_tensor([self.batch_size, self.text_seq_length]       ,							self.num_labels      )

          _SCREAMING_SNAKE_CASE      =				LayoutLMvaConfig(
              vocab_size=self.vocab_size       ,							hidden_size=self.hidden_size       ,							num_hidden_layers=self.num_hidden_layers       ,							num_attention_heads=self.num_attention_heads       ,							intermediate_size=self.intermediate_size       ,							hidden_act=self.hidden_act       ,							hidden_dropout_prob=self.hidden_dropout_prob       ,							attention_probs_dropout_prob=self.attention_probs_dropout_prob       ,							max_position_embeddings=self.max_position_embeddings       ,							type_vocab_size=self.type_vocab_size       ,							initializer_range=self.initializer_range       ,							coordinate_size=self.coordinate_size       ,							shape_size=self.shape_size       ,							input_size=self.image_size       ,							patch_size=self.patch_size       ,							)

          return config, input_ids, bbox, pixel_values, token_type_ids, input_mask, sequence_labels, token_labels






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )    ->			Tuple:
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaModel(config=A__      )

          # text + image
          _SCREAMING_SNAKE_CASE      =				model(A__       ,							pixel_values=A__       ,							training=A__      )
          _SCREAMING_SNAKE_CASE      =				model(
              A__       ,							bbox=A__       ,							pixel_values=A__       ,							attention_mask=A__       ,							token_type_ids=A__       ,							training=A__       ,							)
          _SCREAMING_SNAKE_CASE      =				model(A__       ,							bbox=A__       ,							pixel_values=A__       ,							training=A__      )

          self.parent.assertEqual(result.last_hidden_state.shape       ,							(self.batch_size, self.seq_length, self.hidden_size)      )

          # text only
          _SCREAMING_SNAKE_CASE      =				model(A__       ,							training=A__      )
          self.parent.assertEqual(
              result.last_hidden_state.shape       ,							(self.batch_size, self.text_seq_length, self.hidden_size)      )

          # image only
          _SCREAMING_SNAKE_CASE      =				model({"""pixel_values""": pixel_values}       ,							training=A__      )
          self.parent.assertEqual(
              result.last_hidden_state.shape       ,							(self.batch_size, self.image_seq_length, self.hidden_size)      )






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )    ->			Tuple:
          _SCREAMING_SNAKE_CASE      =				self.num_labels
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaForSequenceClassification(config=A__      )
          _SCREAMING_SNAKE_CASE      =				model(
              A__       ,							bbox=A__       ,							pixel_values=A__       ,							attention_mask=A__       ,							token_type_ids=A__       ,							labels=A__       ,							training=A__       ,							)
          self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.num_labels)      )






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )    ->			Tuple:
          _SCREAMING_SNAKE_CASE      =				self.num_labels
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaForTokenClassification(config=A__      )
          _SCREAMING_SNAKE_CASE      =				model(
              A__       ,							bbox=A__       ,							pixel_values=A__       ,							attention_mask=A__       ,							token_type_ids=A__       ,							labels=A__       ,							training=A__       ,							)
          self.parent.assertEqual(result.logits.shape       ,							(self.batch_size, self.text_seq_length, self.num_labels)      )






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )    ->			Union[str, Any]:
          _SCREAMING_SNAKE_CASE      =				2
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaForQuestionAnswering(config=A__      )
          _SCREAMING_SNAKE_CASE      =				model(
              A__       ,							bbox=A__       ,							pixel_values=A__       ,							attention_mask=A__       ,							token_type_ids=A__       ,							start_positions=A__       ,							end_positions=A__       ,							training=A__       ,							)
          self.parent.assertEqual(result.start_logits.shape       ,							(self.batch_size, self.seq_length)      )
          self.parent.assertEqual(result.end_logits.shape       ,							(self.batch_size, self.seq_length)      )






       def        UpperCamelCase				(							self      )    ->			List[Any]:
          _SCREAMING_SNAKE_CASE      =				self.prepare_config_and_inputs()
          ((_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE) ,							(_SCREAMING_SNAKE_CASE))      =				config_and_inputs
          _SCREAMING_SNAKE_CASE      =				{
              """input_ids""": input_ids,
              """bbox""": bbox,
              """pixel_values""": pixel_values,
              """token_type_ids""": token_type_ids,
              """attention_mask""": input_mask,
          }
          return config, inputs_dict






@require_tf
class    _a				(_lowerCamelCase  ,					_lowerCamelCase  ,					unittest.TestCase):
       SCREAMING_SNAKE_CASE      =  (
           (
               TFLayoutLMvaModel,
               TFLayoutLMvaForQuestionAnswering,
               TFLayoutLMvaForSequenceClassification,
               TFLayoutLMvaForTokenClassification,
           )
           if is_tf_available()
           else ()
       )
       SCREAMING_SNAKE_CASE      =  (
           {'document-question-answering': TFLayoutLMvaForQuestionAnswering, 'feature-extraction': TFLayoutLMvaModel}
           if is_tf_available()
           else {}
       )

       SCREAMING_SNAKE_CASE      =  False
       SCREAMING_SNAKE_CASE      =  False
       SCREAMING_SNAKE_CASE      =  False






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )    ->			List[Any]:
          return True






       def        UpperCamelCase				(							self       ,							A__       ,							A__       ,							A__=False      )    ->			dict:
          _SCREAMING_SNAKE_CASE      =				copy.deepcopy(A__      )

          if model_class in get_values(A__      ):
             _SCREAMING_SNAKE_CASE      =				{
                 k: tf.tile(tf.expand_dims(A__       ,							1      )       ,							(1, self.model_tester.num_choices) + (1,) * (v.ndim - 1)      )
                 if isinstance(A__       ,							tf.Tensor      ) and v.ndim > 0
                 else v
                 for k, v in inputs_dict.items()
             }

          if return_labels:
             if model_class in get_values(A__      ):
                _SCREAMING_SNAKE_CASE      =				tf.ones(self.model_tester.batch_size       ,							dtype=tf.intaa      )
             elif model_class in get_values(A__      ):
                _SCREAMING_SNAKE_CASE      =				tf.zeros(self.model_tester.batch_size       ,							dtype=tf.intaa      )
                _SCREAMING_SNAKE_CASE      =				tf.zeros(self.model_tester.batch_size       ,							dtype=tf.intaa      )
             elif model_class in get_values(A__      ):
                _SCREAMING_SNAKE_CASE      =				tf.zeros(self.model_tester.batch_size       ,							dtype=tf.intaa      )
             elif model_class in get_values(A__      ):
                _SCREAMING_SNAKE_CASE      =				tf.zeros(
                    (self.model_tester.batch_size, self.model_tester.text_seq_length)       ,							dtype=tf.intaa      )

          return inputs_dict






       def        UpperCamelCase				(							self      )    ->			Tuple:
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaModelTester(self      )
          _SCREAMING_SNAKE_CASE      =				ConfigTester(self       ,							config_class=A__       ,							hidden_size=37      )






       def        UpperCamelCase				(							self      )    ->			Union[str, Any]:
          self.config_tester.run_common_tests()






       def        UpperCamelCase				(							self      )    ->			Union[str, Any]:
          _SCREAMING_SNAKE_CASE ,							_SCREAMING_SNAKE_CASE      =				self.model_tester.prepare_config_and_inputs_for_common()
          for model_class in self.all_model_classes:
             _SCREAMING_SNAKE_CASE      =				model_class(A__      )
             if getattr(A__       ,							"""hf_compute_loss"""       ,							A__      ):
                # The number of elements in the loss should be the same as the number of elements in the label
                _SCREAMING_SNAKE_CASE      =				self._prepare_for_class(inputs_dict.copy()       ,							A__       ,							return_labels=A__      )
                _SCREAMING_SNAKE_CASE      =				prepared_for_class[
                    sorted(prepared_for_class.keys() - inputs_dict.keys()       ,							reverse=A__      )[0]
                ]
                _SCREAMING_SNAKE_CASE      =				added_label.shape.as_list()[:1]

                # Test that model correctly compute the loss with kwargs
                _SCREAMING_SNAKE_CASE      =				self._prepare_for_class(inputs_dict.copy()       ,							A__       ,							return_labels=A__      )
                _SCREAMING_SNAKE_CASE      =				prepared_for_class.pop("""input_ids"""      )

                _SCREAMING_SNAKE_CASE      =				model(A__       ,							**A__      )[0]
                self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]      )

                # Test that model correctly compute the loss when we mask some positions
                _SCREAMING_SNAKE_CASE      =				self._prepare_for_class(inputs_dict.copy()       ,							A__       ,							return_labels=A__      )
                _SCREAMING_SNAKE_CASE      =				prepared_for_class.pop("""input_ids"""      )
                if "labels" in prepared_for_class:
                   _SCREAMING_SNAKE_CASE      =				prepared_for_class["""labels"""].numpy()
                   if len(labels.shape      ) > 1 and labels.shape[1] != 1:
                      _SCREAMING_SNAKE_CASE      =				-1_00
                      _SCREAMING_SNAKE_CASE      =				tf.convert_to_tensor(A__      )
                      _SCREAMING_SNAKE_CASE      =				model(A__       ,							**A__      )[0]
                      self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]      )
                      self.assertTrue(not np.any(np.isnan(loss.numpy()      )      )      )

                         # Test that model correctly compute the loss with a dict
                _SCREAMING_SNAKE_CASE      =				self._prepare_for_class(inputs_dict.copy()       ,							A__       ,							return_labels=A__      )
                _SCREAMING_SNAKE_CASE      =				model(A__      )[0]
                self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]      )

                # Test that model correctly compute the loss with a tuple
                _SCREAMING_SNAKE_CASE      =				self._prepare_for_class(inputs_dict.copy()       ,							A__       ,							return_labels=A__      )

                # Get keys that were added with the _prepare_for_class function
                _SCREAMING_SNAKE_CASE      =				prepared_for_class.keys() - inputs_dict.keys()
                _SCREAMING_SNAKE_CASE      =				inspect.signature(model.call      ).parameters
                _SCREAMING_SNAKE_CASE      =				list(signature.keys()      )

                # Create a dictionary holding the location of the tensors in the tuple
                _SCREAMING_SNAKE_CASE      =				{0: """input_ids"""}
                for label_key in label_keys:
                   _SCREAMING_SNAKE_CASE      =				signature_names.index(A__      )
                   _SCREAMING_SNAKE_CASE      =				label_key
                _SCREAMING_SNAKE_CASE      =				sorted(tuple_index_mapping.items()      )
                # Initialize a list with their default values, update the values and convert to a tuple
                _SCREAMING_SNAKE_CASE      =				[]

                for name in signature_names:
                   if name != "kwargs":
                      list_input.append(signature[name].default      )

                for index, value in sorted_tuple_index_mapping:
                   _SCREAMING_SNAKE_CASE      =				prepared_for_class[value]

                _SCREAMING_SNAKE_CASE      =				tuple(A__      )

                # Send to model
                _SCREAMING_SNAKE_CASE      =				model(tuple_input[:-1]      )[0]

                self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]      )






       def        UpperCamelCase				(							self      )    ->			Tuple:
          (
              (
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,												
          )      =				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_model(A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )






       def        UpperCamelCase				(							self      )    ->			Union[str, Any]:
          (
              (
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,												
          )      =				self.model_tester.prepare_config_and_inputs()
          for type in ["absolute", "relative_key", "relative_key_query"]:
             _SCREAMING_SNAKE_CASE      =				type
             self.model_tester.create_and_check_model(A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )






       def        UpperCamelCase				(							self      )    ->			Any:
          (
              (
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,												
          )      =				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_sequence_classification(
              A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )






       def        UpperCamelCase				(							self      )    ->			List[str]:
          (
              (
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,												
          )      =				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_token_classification(
              A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )






       def        UpperCamelCase				(							self      )    ->			Optional[Any]:
          (
              (
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,							(
              _SCREAMING_SNAKE_CASE					
          ) ,												
          )      =				self.model_tester.prepare_config_and_inputs()
          self.model_tester.create_and_check_for_question_answering(
              A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__       ,							A__      )






       @slow
       def        UpperCamelCase				(							self      )    ->			int:







          for model_name in TF_LAYOUTLMV3_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
             _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaModel.from_pretrained(A__      )
             self.assertIsNotNone(A__      )






def    lowerCAmelCase_	(				)     ->     Optional[Any]:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE      =				Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""						)
   return image







@require_tf
class    _a				(unittest.TestCase):






       @cached_property
       def        UpperCamelCase				(							self      )    ->			List[Any]:
          return LayoutLMvaImageProcessor(apply_ocr=A__      ) if is_vision_available() else None






       @slow
       def        UpperCamelCase				(							self      )    ->			List[Any]:
          _SCREAMING_SNAKE_CASE      =				TFLayoutLMvaModel.from_pretrained("""microsoft/layoutlmv3-base"""      )

          _SCREAMING_SNAKE_CASE      =				self.default_image_processor
          _SCREAMING_SNAKE_CASE      =				prepare_img()
          _SCREAMING_SNAKE_CASE      =				image_processor(images=A__       ,							return_tensors="""tf"""      ).pixel_values

          _SCREAMING_SNAKE_CASE      =				tf.constant([[1, 2]]      )
          _SCREAMING_SNAKE_CASE      =				tf.expand_dims(tf.constant([[1, 2, 3, 4], [5, 6, 7, 8]]      )       ,							axis=0      )

          # forward pass
          _SCREAMING_SNAKE_CASE      =				model(input_ids=A__       ,							bbox=A__       ,							pixel_values=A__       ,							training=A__      )

          # verify the logits
          _SCREAMING_SNAKE_CASE      =				(1, 1_99, 7_68)
          self.assertEqual(outputs.last_hidden_state.shape       ,							A__      )

          _SCREAMING_SNAKE_CASE      =				tf.constant(
              [[-0.0529, 0.3618, 0.1632], [-0.1587, -0.1667, -0.0400], [-0.1557, -0.1671, -0.0505]]      )

          self.assertTrue(np.allclose(outputs.last_hidden_state[0, :3, :3]       ,							A__       ,							atol=1E-4      )      )








'''simple docstring'''



import sys

UpperCamelCase__      :		int       							=  (
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)
def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_ = N						)     ->     int:




   """simple docstring"""
   _SCREAMING_SNAKE_CASE      =				-sys.maxsize - 1
   for i in range(len(SCREAMING_SNAKE_CASE_						) - 12						):
      _SCREAMING_SNAKE_CASE      =				1
      for j in range(13						):
         product *= int(n[i + j]						)
      if product > largest_product:
         _SCREAMING_SNAKE_CASE      =				product
   return largest_product


if __name__ == "__main__":
     print(f"""{solution() = }""")






