



"""simple docstring"""







from __future__ import annotations

import unittest

from transformers import RoFormerConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

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


if is_tf_available():
     import tensorflow as tf

     from transformers import (
         TFRoFormerForCausalLM,
         TFRoFormerForMaskedLM,
         TFRoFormerForMultipleChoice,
         TFRoFormerForQuestionAnswering,
         TFRoFormerForSequenceClassification,
         TFRoFormerForTokenClassification,
         TFRoFormerModel,
     )
     from transformers.models.roformer.modeling_tf_roformer import (
         TFRoFormerSelfAttention,
         TFRoFormerSinusoidalPositionalEmbedding,
     )







class 				UpperCamelCase__       :




      """simple docstring"""




      def __init__(				self    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=1_3   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=7   ,      SCREAMING_SNAKE_CASE_    :				Tuple=True   ,      SCREAMING_SNAKE_CASE_    :				str=True   ,      SCREAMING_SNAKE_CASE_    :				Dict=True   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=True   ,      SCREAMING_SNAKE_CASE_    :				Dict=9_9   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=3_2   ,      SCREAMING_SNAKE_CASE_    :				Tuple=2   ,      SCREAMING_SNAKE_CASE_    :				int=4   ,      SCREAMING_SNAKE_CASE_    :				Tuple=3_7   ,      SCREAMING_SNAKE_CASE_    :				List[str]="gelu"   ,      SCREAMING_SNAKE_CASE_    :				List[str]=0.1   ,      SCREAMING_SNAKE_CASE_    :				str=0.1   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=5_1_2   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=1_6   ,      SCREAMING_SNAKE_CASE_    :				List[str]=2   ,      SCREAMING_SNAKE_CASE_    :				List[Any]=0.02   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]=3   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=4   ,      SCREAMING_SNAKE_CASE_    :				Any=None   ,      ):
        lowerCAmelCase_       :    List[str]								=			parent
        lowerCAmelCase_       :    List[str]								=			1_3
        lowerCAmelCase_       :    List[Any]								=			7
        lowerCAmelCase_       :    Any								=			True
        lowerCAmelCase_       :    int								=			True
        lowerCAmelCase_       :    Optional[int]								=			True
        lowerCAmelCase_       :    str								=			True
        lowerCAmelCase_       :    Dict								=			9_9
        lowerCAmelCase_       :    Tuple								=			3_2
        lowerCAmelCase_       :    Any								=			2
        lowerCAmelCase_       :    List[str]								=			4
        lowerCAmelCase_       :    Tuple								=			3_7
        lowerCAmelCase_       :    List[str]								=			'gelu'
        lowerCAmelCase_       :    Optional[int]								=			0.1
        lowerCAmelCase_       :    Any								=			0.1
        lowerCAmelCase_       :    Any								=			5_1_2
        lowerCAmelCase_       :    Union[str, Any]								=			1_6
        lowerCAmelCase_       :    Dict								=			2
        lowerCAmelCase_       :    Optional[int]								=			0.02
        lowerCAmelCase_       :    Dict								=			3
        lowerCAmelCase_       :    int								=			4
        lowerCAmelCase_       :    str								=			None



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Union[str, Any]	):
        lowerCAmelCase_       :    Any								=			ids_tensor([self.batch_size, self.seq_length]   ,      self.vocab_size	)

        lowerCAmelCase_       :    int								=			None
        if self.use_input_mask:
          lowerCAmelCase_       :    Any								=			random_attention_mask([self.batch_size, self.seq_length]	)

        lowerCAmelCase_       :    Any								=			None
        if self.use_token_type_ids:
          lowerCAmelCase_       :    Tuple								=			ids_tensor([self.batch_size, self.seq_length]   ,      self.type_vocab_size	)

        lowerCAmelCase_       :    Dict								=			None
        lowerCAmelCase_       :    Dict								=			None
        lowerCAmelCase_       :    Union[str, Any]								=			None
        if self.use_labels:
          lowerCAmelCase_       :    Union[str, Any]								=			ids_tensor([self.batch_size]   ,      self.type_sequence_label_size	)
          lowerCAmelCase_       :    Optional[int]								=			ids_tensor([self.batch_size, self.seq_length]   ,      self.num_labels	)
          lowerCAmelCase_       :    Tuple								=			ids_tensor([self.batch_size]   ,      self.num_choices	)

        lowerCAmelCase_       :    Dict								=			RoFormerConfig(
            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   ,      return_dict=SCREAMING_SNAKE_CASE_   ,      )

        return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]	):
        lowerCAmelCase_       :    List[str]								=			TFRoFormerModel(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    int								=			{'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}

        lowerCAmelCase_       :    Tuple								=			[input_ids, input_mask]
        lowerCAmelCase_       :    Optional[Any]								=			model(SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    Optional[Any]								=			model(SCREAMING_SNAKE_CASE_	)

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



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Any   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				int	):
        lowerCAmelCase_       :    str								=			True
        lowerCAmelCase_       :    str								=			TFRoFormerForCausalLM(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Union[str, Any]								=			{
            'input_ids': input_ids,
            'attention_mask': input_mask,
            'token_type_ids': token_type_ids,
        }
        lowerCAmelCase_       :    Tuple								=			model(SCREAMING_SNAKE_CASE_	)['logits']
        self.parent.assertListEqual(
            list(prediction_scores.numpy().shape	)   ,      [self.batch_size, self.seq_length, self.vocab_size]	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				int   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				List[Any]	):
        lowerCAmelCase_       :    Dict								=			TFRoFormerForMaskedLM(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    int								=			{
            'input_ids': input_ids,
            'attention_mask': input_mask,
            'token_type_ids': token_type_ids,
        }
        lowerCAmelCase_       :    str								=			model(SCREAMING_SNAKE_CASE_	)
        self.parent.assertEqual(result.logits.shape   ,      (self.batch_size, self.seq_length, self.vocab_size)	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Dict   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				Any	):
        lowerCAmelCase_       :    Dict								=			self.num_labels
        lowerCAmelCase_       :    List[str]								=			TFRoFormerForSequenceClassification(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    List[Any]								=			{
            'input_ids': input_ids,
            'attention_mask': input_mask,
            'token_type_ids': token_type_ids,
        }

        lowerCAmelCase_       :    Any								=			model(SCREAMING_SNAKE_CASE_	)
        self.parent.assertEqual(result.logits.shape   ,      (self.batch_size, self.num_labels)	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				int   ,      SCREAMING_SNAKE_CASE_    :				Dict   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				Dict	):
        lowerCAmelCase_       :    List[Any]								=			self.num_choices
        lowerCAmelCase_       :    List[Any]								=			TFRoFormerForMultipleChoice(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    Union[str, Any]								=			tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE_   ,      1	)   ,      (1, self.num_choices, 1)	)
        lowerCAmelCase_       :    Any								=			tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE_   ,      1	)   ,      (1, self.num_choices, 1)	)
        lowerCAmelCase_       :    int								=			tf.tile(tf.expand_dims(SCREAMING_SNAKE_CASE_   ,      1	)   ,      (1, self.num_choices, 1)	)
        lowerCAmelCase_       :    Optional[int]								=			{
            'input_ids': multiple_choice_inputs_ids,
            'attention_mask': multiple_choice_input_mask,
            'token_type_ids': multiple_choice_token_type_ids,
        }
        lowerCAmelCase_       :    List[str]								=			model(SCREAMING_SNAKE_CASE_	)
        self.parent.assertEqual(result.logits.shape   ,      (self.batch_size, self.num_choices)	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Union[str, Any]   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				str	):
        lowerCAmelCase_       :    List[Any]								=			self.num_labels
        lowerCAmelCase_       :    Dict								=			TFRoFormerForTokenClassification(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    int								=			{
            'input_ids': input_ids,
            'attention_mask': input_mask,
            'token_type_ids': token_type_ids,
        }
        lowerCAmelCase_       :    Union[str, Any]								=			model(SCREAMING_SNAKE_CASE_	)
        self.parent.assertEqual(result.logits.shape   ,      (self.batch_size, self.seq_length, self.num_labels)	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				str   ,      SCREAMING_SNAKE_CASE_    :				Dict   ,      SCREAMING_SNAKE_CASE_    :				str   ,      SCREAMING_SNAKE_CASE_    :				Any   ,      SCREAMING_SNAKE_CASE_    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				Tuple	):
        lowerCAmelCase_       :    Tuple								=			TFRoFormerForQuestionAnswering(config=SCREAMING_SNAKE_CASE_	)
        lowerCAmelCase_       :    List[str]								=			{
            'input_ids': input_ids,
            'attention_mask': input_mask,
            'token_type_ids': token_type_ids,
        }

        lowerCAmelCase_       :    str								=			model(SCREAMING_SNAKE_CASE_	)
        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 					SCREAMING_SNAKE_CASE__			(				self    :				int	):
        lowerCAmelCase_       :    str								=			self.prepare_config_and_inputs()
        (
            (
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,(
            lowerCAmelCase_
        )						,
        )       :    List[Any]								=			config_and_inputs
        lowerCAmelCase_       :    Tuple								=			{'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
        return config, inputs_dict







@require_tf
class 				UpperCamelCase__       (     lowercase_, lowercase_, unittest.TestCase  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					(
          (
              TFRoFormerModel,
              TFRoFormerForCausalLM,
              TFRoFormerForMaskedLM,
              TFRoFormerForQuestionAnswering,
              TFRoFormerForSequenceClassification,
              TFRoFormerForTokenClassification,
              TFRoFormerForMultipleChoice,
          )
          if is_tf_available()
          else ()
      )
      _SCREAMING_SNAKE_CASE      =					(
          {
              """feature-extraction""": TFRoFormerModel,
              """fill-mask""": TFRoFormerForMaskedLM,
              """question-answering""": TFRoFormerForQuestionAnswering,
              """text-classification""": TFRoFormerForSequenceClassification,
              """text-generation""": TFRoFormerForCausalLM,
              """token-classification""": TFRoFormerForTokenClassification,
              """zero-shot""": TFRoFormerForSequenceClassification,
          }
          if is_tf_available()
          else {}
      )

      _SCREAMING_SNAKE_CASE      =					False
      _SCREAMING_SNAKE_CASE      =					False



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				Tuple   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]   ,      SCREAMING_SNAKE_CASE_    :				int   ,      SCREAMING_SNAKE_CASE_    :				Optional[Any]	):
        if pipeline_test_casse_name == "TextGenerationPipelineTests":
          return True

        return False



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]	):
        lowerCAmelCase_       :    int								=			TFRoFormerModelTester(self	)
        lowerCAmelCase_       :    Optional[Any]								=			ConfigTester(self   ,      config_class=SCREAMING_SNAKE_CASE_   ,      hidden_size=3_7	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Any	):
        self.config_tester.run_common_tests()



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    Tuple								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]	):
        lowerCAmelCase_       :    Optional[Any]								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_masked_lm(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Any	):
        lowerCAmelCase_       :    List[Any]								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_lm_head(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				str	):
        lowerCAmelCase_       :    Optional[Any]								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_multiple_choice(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    Tuple								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_question_answering(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]	):
        lowerCAmelCase_       :    Optional[int]								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_sequence_classification(*SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]	):
        lowerCAmelCase_       :    int								=			self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_token_classification(*SCREAMING_SNAKE_CASE_	)





      @slow
      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[str]	):
        lowerCAmelCase_       :    Optional[Any]								=			TFRoFormerModel.from_pretrained('junnyu/roformer_chinese_base'	)
        self.assertIsNotNone(SCREAMING_SNAKE_CASE_	)







@require_tf
class 				UpperCamelCase__       (     unittest.TestCase  ):




      """simple docstring"""




      @slow
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    Tuple								=			TFRoFormerForMaskedLM.from_pretrained('junnyu/roformer_chinese_base'	)
        lowerCAmelCase_       :    Optional[Any]								=			tf.constant([[0, 1, 2, 3, 4, 5]]	)
        lowerCAmelCase_       :    Tuple								=			model(SCREAMING_SNAKE_CASE_	)[0]

        # TODO Replace vocab size
        lowerCAmelCase_       :    Tuple								=			5_0_0_0_0

        lowerCAmelCase_       :    str								=			[1, 6, vocab_size]
        self.assertEqual(output.shape   ,      SCREAMING_SNAKE_CASE_	)

        print(output[:, :3, :3]	)

        # TODO Replace values below with what was printed above.
        lowerCAmelCase_       :    Any								=			tf.constant(
            [
                [
                    [-0.12_05_33_41, -1.0_26_49_01, 0.29_22_19_46],
                    [-1.5_13_37_83, 0.19_74_33, 0.15_19_06_07],
                    [-5.0_13_54_03, -3.90_02_56, -0.84_03_87_64],
                ]
            ]	)
        tf.debugging.assert_near(output[:, :3, :3]   ,      SCREAMING_SNAKE_CASE_   ,      atol=1E-4	)







@require_tf
class 				UpperCamelCase__       (     unittest.TestCase  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					1e-4



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    str								=			tf.constant([[4, 1_0]]	)
        lowerCAmelCase_       :    Tuple								=			TFRoFormerSinusoidalPositionalEmbedding(num_positions=6   ,      embedding_dim=6	)

        lowerCAmelCase_       :    Optional[int]								=			emba(input_ids.shape	)
        lowerCAmelCase_       :    Optional[int]								=			tf.constant(
            [[0.00_00, 0.00_00, 0.00_00, 1.00_00, 1.00_00, 1.00_00], [0.84_15, 0.04_64, 0.00_22, 0.54_03, 0.99_89, 1.00_00]]	)

        tf.debugging.assert_near(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_   ,      atol=self.tolerance	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[Any]	):
        lowerCAmelCase_       :    Optional[int]								=			tf.constant(
            [
                [0.00_00, 0.00_00, 0.00_00, 0.00_00, 0.00_00],
                [0.84_15, 0.82_19, 0.80_20, 0.78_19, 0.76_17],
                [0.90_93, 0.93_64, 0.95_81, 0.97_49, 0.98_70],
            ]	)
        lowerCAmelCase_       :    Optional[Any]								=			TFRoFormerSinusoidalPositionalEmbedding(num_positions=5_1_2   ,      embedding_dim=5_1_2	)
        emba([2, 1_6, 5_1_2]	)
        lowerCAmelCase_       :    Union[str, Any]								=			emba.weight[:3, :5]

        tf.debugging.assert_near(SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_   ,      atol=self.tolerance	)







@require_tf
class 				UpperCamelCase__       (     unittest.TestCase  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					1e-4



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Dict	):
        # 2,12,16,64
        lowerCAmelCase_       :    Optional[int]								=			tf.reshape(tf.range(2 * 1_2 * 1_6 * 6_4   ,      dtype=tf.floataa	)   ,      shape=(2, 1_2, 1_6, 6_4)	) / 1_0_0

        lowerCAmelCase_       :    Any								=			-tf.reshape(tf.range(2 * 1_2 * 1_6 * 6_4   ,      dtype=tf.floataa	)   ,      shape=(2, 1_2, 1_6, 6_4)	) / 1_0_0

        lowerCAmelCase_       :    int								=			TFRoFormerSinusoidalPositionalEmbedding(num_positions=3_2   ,      embedding_dim=6_4	)
        lowerCAmelCase_       :    Union[str, Any]								=			embed_positions([2, 1_6, 7_6_8]	)[None, None, :, :]

        lowerCAmelCase_						,lowerCAmelCase_       :    int								=			TFRoFormerSelfAttention.apply_rotary_position_embeddings(
            SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_   ,      SCREAMING_SNAKE_CASE_	)

        lowerCAmelCase_       :    Dict								=			tf.constant(
            [
                [0.00_00, 0.01_00, 0.02_00, 0.03_00, 0.04_00, 0.05_00, 0.06_00, 0.07_00],
                [-0.20_12, 0.88_97, 0.02_63, 0.94_01, 0.20_74, 0.94_63, 0.34_81, 0.93_43],
                [-1.70_57, 0.62_71, -1.21_45, 1.38_97, -0.63_03, 1.76_47, -0.11_73, 1.89_85],
                [-2.17_31, -1.63_97, -2.73_58, 0.28_54, -2.18_40, 1.71_83, -1.30_18, 2.48_71],
                [0.27_17, -3.61_73, -2.92_06, -2.19_88, -3.66_38, 0.38_58, -2.91_55, 2.29_80],
                [3.98_59, -2.15_80, -0.79_84, -4.49_04, -4.11_81, -2.02_52, -4.47_82, 1.12_53],
            ]	)
        lowerCAmelCase_       :    Any								=			tf.constant(
            [
                [0.00_00, -0.01_00, -0.02_00, -0.03_00, -0.04_00, -0.05_00, -0.06_00, -0.07_00],
                [0.20_12, -0.88_97, -0.02_63, -0.94_01, -0.20_74, -0.94_63, -0.34_81, -0.93_43],
                [1.70_57, -0.62_71, 1.21_45, -1.38_97, 0.63_03, -1.76_47, 0.11_73, -1.89_85],
                [2.17_31, 1.63_97, 2.73_58, -0.28_54, 2.18_40, -1.71_83, 1.30_18, -2.48_71],
                [-0.27_17, 3.61_73, 2.92_06, 2.19_88, 3.66_38, -0.38_58, 2.91_55, -2.29_80],
                [-3.98_59, 2.15_80, 0.79_84, 4.49_04, 4.11_81, 2.02_52, 4.47_82, -1.12_53],
            ]	)

        tf.debugging.assert_near(query_layer[0, 0, :6, :8]   ,      SCREAMING_SNAKE_CASE_   ,      atol=self.tolerance	)
        tf.debugging.assert_near(key_layer[0, 0, :6, :8]   ,      SCREAMING_SNAKE_CASE_   ,      atol=self.tolerance	)










"""simple docstring"""







from diffusers.utils.testing_utils import require_onnxruntime







@require_onnxruntime
class 				UpperCamelCase__       :




      """simple docstring"""




      pass





