
'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import MobileBertConfig, is_tf_available
from transformers.models.auto import get_values
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 (
      TF_MODEL_FOR_PRETRAINING_MAPPING,
      TFMobileBertForMaskedLM,
      TFMobileBertForMultipleChoice,
      TFMobileBertForNextSentencePrediction,
      TFMobileBertForPreTraining,
      TFMobileBertForQuestionAnswering,
      TFMobileBertForSequenceClassification,
      TFMobileBertForTokenClassification,
      TFMobileBertModel,
  )







@require_tf
class UpperCAmelCase__	( lowercase__    ,				lowercase__    ,				unittest.TestCase	):





  """simple docstring"""

  __UpperCAmelCase				:				Tuple   =					(
      (
          TFMobileBertModel,
          TFMobileBertForMaskedLM,
          TFMobileBertForNextSentencePrediction,
          TFMobileBertForPreTraining,
          TFMobileBertForQuestionAnswering,
          TFMobileBertForSequenceClassification,
          TFMobileBertForTokenClassification,
          TFMobileBertForMultipleChoice,
      )
      if is_tf_available()
      else ()
  )
  __UpperCAmelCase				:				Dict   =					(
      {
          '''feature-extraction''': TFMobileBertModel,
          '''fill-mask''': TFMobileBertForMaskedLM,
          '''question-answering''': TFMobileBertForQuestionAnswering,
          '''text-classification''': TFMobileBertForSequenceClassification,
          '''token-classification''': TFMobileBertForTokenClassification,
          '''zero-shot''': TFMobileBertForSequenceClassification,
      }
      if is_tf_available()
      else {}
  )
  __UpperCAmelCase				:				Dict   =					False
  __UpperCAmelCase				:				Tuple   =					False


  def   __lowercase		(		self      :     Dict							,_a      :     List[Any]							,_a      :     Any							,_a      :     int=False       ):


     '''simple docstring'''






     _a				:	Dict			=   super()._prepare_for_class(lowerCamelCase__							,lowerCamelCase__							,return_labels=lowerCamelCase__       )

     if return_labels:
        if model_class in get_values(lowerCamelCase__       ):
           _a				:	List[Any]			=   tf.zeros(self.model_tester.batch_size							,dtype=tf.intaa       )

     return inputs_dict







  class UpperCAmelCase__	( lowercase__	):





    """simple docstring"""

    def __init__(		self      :     Union[str, Any]							,_a      :     int							,_a      :     int=13							,_a      :     List[str]=7							,_a      :     Tuple=True							,_a      :     Optional[int]=True							,_a      :     List[str]=True							,_a      :     List[str]=True							,_a      :     Union[str, Any]=99							,_a      :     Dict=32							,_a      :     Optional[int]=32							,_a      :     int=2							,_a      :     Tuple=4							,_a      :     int=37							,_a      :     Tuple="gelu"							,_a      :     int=0.1							,_a      :     Tuple=0.1							,_a      :     Union[str, Any]=512							,_a      :     Union[str, Any]=16							,_a      :     Any=2							,_a      :     Optional[Any]=0.02							,_a      :     Dict=3							,_a      :     Dict=4							,_a      :     List[Any]=None							,):


       '''simple docstring'''






       _a				:	Tuple			=   parent
       _a				:	Any			=   batch_size
       _a				:	Dict			=   seq_length
       _a				:	Optional[Any]			=   is_training
       _a				:	Optional[Any]			=   use_input_mask
       _a				:	Dict			=   use_token_type_ids
       _a				:	Union[str, Any]			=   use_labels
       _a				:	str			=   vocab_size
       _a				:	Union[str, Any]			=   hidden_size
       _a				:	Optional[int]			=   num_hidden_layers
       _a				:	Dict			=   num_attention_heads
       _a				:	Tuple			=   intermediate_size
       _a				:	Any			=   hidden_act
       _a				:	Any			=   hidden_dropout_prob
       _a				:	Union[str, Any]			=   attention_probs_dropout_prob
       _a				:	Dict			=   max_position_embeddings
       _a				:	Union[str, Any]			=   type_vocab_size
       _a				:	Tuple			=   type_sequence_label_size
       _a				:	Tuple			=   initializer_range
       _a				:	Any			=   num_labels
       _a				:	int			=   num_choices
       _a				:	int			=   scope
       _a				:	str			=   embedding_size


    def   __lowercase		(		self      :     Optional[Any]       ):


       '''simple docstring'''






       _a				:	Optional[Any]			=   ids_tensor([self.batch_size, self.seq_length]							,self.vocab_size       )

       _a				:	List[str]			=   None
       if self.use_input_mask:
          _a				:	Union[str, Any]			=   random_attention_mask([self.batch_size, self.seq_length]       )

       _a				:	Tuple			=   None
       if self.use_token_type_ids:
          _a				:	List[str]			=   ids_tensor([self.batch_size, self.seq_length]							,self.type_vocab_size       )

       _a				:	List[str]			=   None
       _a				:	Optional[Any]			=   None
       _a				:	Any			=   None
       if self.use_labels:
          _a				:	List[Any]			=   ids_tensor([self.batch_size]							,self.type_sequence_label_size       )
          _a				:	Tuple			=   ids_tensor([self.batch_size, self.seq_length]							,self.num_labels       )
          _a				:	List[Any]			=   ids_tensor([self.batch_size]							,self.num_choices       )

       _a				:	List[Any]			=   MobileBertConfig(
           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							,embedding_size=self.embedding_size							,)

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


    def   __lowercase		(		self      :     Optional[int]							,_a      :     str							,_a      :     Optional[Any]							,_a      :     Union[str, Any]							,_a      :     List[Any]							,_a      :     Tuple							,_a      :     List[Any]							,_a      :     Optional[int]       ):


       '''simple docstring'''






       _a				:	List[Any]			=   TFMobileBertModel(config=lowerCamelCase__       )
       _a				:	List[str]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	List[str]			=   model(lowerCamelCase__       )

       _a				:	Dict			=   [input_ids, input_mask]
       _a				:	Optional[int]			=   model(lowerCamelCase__       )

       _a				:	Optional[Any]			=   model(lowerCamelCase__       )

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


    def   __lowercase		(		self      :     List[str]							,_a      :     Optional[int]							,_a      :     Optional[Any]							,_a      :     int							,_a      :     Dict							,_a      :     Optional[Any]							,_a      :     Optional[int]							,_a      :     Optional[Any]       ):


       '''simple docstring'''






       _a				:	List[Any]			=   TFMobileBertForMaskedLM(config=lowerCamelCase__       )
       _a				:	Optional[Any]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	Optional[Any]			=   model(lowerCamelCase__       )
       self.parent.assertEqual(result.logits.shape							,(self.batch_size, self.seq_length, self.vocab_size)       )


    def   __lowercase		(		self      :     Any							,_a      :     List[str]							,_a      :     Any							,_a      :     Dict							,_a      :     str							,_a      :     List[str]							,_a      :     Optional[Any]							,_a      :     str       ):


       '''simple docstring'''






       _a				:	int			=   TFMobileBertForNextSentencePrediction(config=lowerCamelCase__       )
       _a				:	List[Any]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	str			=   model(lowerCamelCase__       )
       self.parent.assertEqual(result.logits.shape							,(self.batch_size, 2)       )


    def   __lowercase		(		self      :     int							,_a      :     List[Any]							,_a      :     Optional[int]							,_a      :     Optional[Any]							,_a      :     Optional[int]							,_a      :     Optional[int]							,_a      :     List[str]							,_a      :     str       ):


       '''simple docstring'''






       _a				:	Tuple			=   TFMobileBertForPreTraining(config=lowerCamelCase__       )
       _a				:	Optional[int]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	Tuple			=   model(lowerCamelCase__       )
       self.parent.assertEqual(
           result.prediction_logits.shape							,(self.batch_size, self.seq_length, self.vocab_size)       )
       self.parent.assertEqual(result.seq_relationship_logits.shape							,(self.batch_size, 2)       )


    def   __lowercase		(		self      :     Dict							,_a      :     List[Any]							,_a      :     Optional[int]							,_a      :     Any							,_a      :     int							,_a      :     Optional[Any]							,_a      :     Union[str, Any]							,_a      :     Tuple       ):


       '''simple docstring'''






       _a				:	Union[str, Any]			=   self.num_labels
       _a				:	Optional[int]			=   TFMobileBertForSequenceClassification(config=lowerCamelCase__       )
       _a				:	str			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	Optional[Any]			=   model(lowerCamelCase__       )
       self.parent.assertEqual(result.logits.shape							,(self.batch_size, self.num_labels)       )


    def   __lowercase		(		self      :     Any							,_a      :     List[str]							,_a      :     Union[str, Any]							,_a      :     List[str]							,_a      :     List[str]							,_a      :     List[str]							,_a      :     str							,_a      :     Tuple       ):


       '''simple docstring'''






       _a				:	Optional[Any]			=   self.num_choices
       _a				:	Tuple			=   TFMobileBertForMultipleChoice(config=lowerCamelCase__       )
       _a				:	Optional[Any]			=   tf.tile(tf.expand_dims(lowerCamelCase__							,1       )							,(1, self.num_choices, 1)       )
       _a				:	str			=   tf.tile(tf.expand_dims(lowerCamelCase__							,1       )							,(1, self.num_choices, 1)       )
       _a				:	Optional[int]			=   tf.tile(tf.expand_dims(lowerCamelCase__							,1       )							,(1, self.num_choices, 1)       )
       _a				:	str			=   {
           'input_ids': multiple_choice_inputs_ids,
           'attention_mask': multiple_choice_input_mask,
           'token_type_ids': multiple_choice_token_type_ids,
       }
       _a				:	Union[str, Any]			=   model(lowerCamelCase__       )
       self.parent.assertEqual(result.logits.shape							,(self.batch_size, self.num_choices)       )


    def   __lowercase		(		self      :     Optional[Any]							,_a      :     List[Any]							,_a      :     str							,_a      :     Any							,_a      :     Optional[int]							,_a      :     Optional[Any]							,_a      :     List[Any]							,_a      :     Any       ):


       '''simple docstring'''






       _a				:	Optional[int]			=   self.num_labels
       _a				:	Optional[int]			=   TFMobileBertForTokenClassification(config=lowerCamelCase__       )
       _a				:	Optional[Any]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	List[str]			=   model(lowerCamelCase__       )
       self.parent.assertEqual(result.logits.shape							,(self.batch_size, self.seq_length, self.num_labels)       )


    def   __lowercase		(		self      :     Any							,_a      :     Tuple							,_a      :     Any							,_a      :     List[Any]							,_a      :     List[str]							,_a      :     Optional[int]							,_a      :     Optional[int]							,_a      :     Optional[int]       ):


       '''simple docstring'''






       _a				:	int			=   TFMobileBertForQuestionAnswering(config=lowerCamelCase__       )
       _a				:	List[Any]			=   {'input_ids': input_ids, 'attention_mask': input_mask, 'token_type_ids': token_type_ids}
       _a				:	Tuple			=   model(lowerCamelCase__       )
       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   __lowercase		(		self      :     Optional[int]       ):


       '''simple docstring'''






       _a				:	Optional[Any]			=   self.prepare_config_and_inputs()
       (
           (
           _a						
       ),  (
           _a						
       ),  (
           _a						
       ),  (
           _a						
       ),  (
           _a						
       ),  (
           _a						
       ),  (
           _a						
       ),  						
       )				:	Any			=   config_and_inputs
       _a				:	str			=   {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
       return config, inputs_dict


  def   __lowercase		(		self      :     str       ):


     '''simple docstring'''






     _a				:	int			=   TFMobileBertModelTest.TFMobileBertModelTester(self       )
     _a				:	Tuple			=   ConfigTester(self							,config_class=lowerCamelCase__							,hidden_size=37       )


  def   __lowercase		(		self      :     Dict       ):


     '''simple docstring'''






     self.config_tester.run_common_tests()


  def   __lowercase		(		self      :     int       ):


     '''simple docstring'''






     _a				:	Union[str, Any]			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_model(*lowerCamelCase__       )


  def   __lowercase		(		self      :     int       ):


     '''simple docstring'''






     _a				:	Union[str, Any]			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_masked_lm(*lowerCamelCase__       )


  def   __lowercase		(		self      :     str       ):


     '''simple docstring'''






     _a				:	int			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_multiple_choice(*lowerCamelCase__       )


  def   __lowercase		(		self      :     str       ):


     '''simple docstring'''






     _a				:	List[Any]			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*lowerCamelCase__       )


  def   __lowercase		(		self      :     Optional[Any]       ):


     '''simple docstring'''






     _a				:	int			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_pretraining(*lowerCamelCase__       )


  def   __lowercase		(		self      :     Any       ):


     '''simple docstring'''






     _a				:	Dict			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_question_answering(*lowerCamelCase__       )


  def   __lowercase		(		self      :     List[str]       ):


     '''simple docstring'''






     _a				:	Optional[int]			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_sequence_classification(*lowerCamelCase__       )


  def   __lowercase		(		self      :     Any       ):


     '''simple docstring'''






     _a				:	str			=   self.model_tester.prepare_config_and_inputs()
     self.model_tester.create_and_check_mobilebert_for_token_classification(*lowerCamelCase__       )


  @slow
  def   __lowercase		(		self      :     str       ):


     '''simple docstring'''






     for model_name in ["google/mobilebert-uncased"]:
        _a				:	Dict			=   TFMobileBertModel.from_pretrained(lowerCamelCase__       )
        self.assertIsNotNone(lowerCamelCase__       )







@require_tf
class UpperCAmelCase__	( unittest.TestCase	):





  """simple docstring"""

  @slow
  def   __lowercase		(		self      :     Dict       ):


     '''simple docstring'''






     _a				:	Any			=   TFMobileBertForPreTraining.from_pretrained('google/mobilebert-uncased'       )
     _a				:	Optional[int]			=   tf.constant([[0, 1, 2, 3, 4, 5]]       )
     _a				:	Dict			=   model(lowerCamelCase__       )[0]

     _a				:	str			=   [1, 6, 3_0522]
     self.assertEqual(output.shape							,lowerCamelCase__       )

     _a				:	List[str]			=   tf.constant(
         [
             [
                 [-4.591_9547, -9.24_8295, -9.64_5256],
                 [-6.730_6175, -6.44_0284, -6.605_2837],
                 [-7.274_3506, -6.784_7915, -6.02_4673],
             ]
         ]       )
     tf.debugging.assert_near(output[:, :3, :3]							,lowerCamelCase__							,atol=1E-4       )









import unittest

import numpy as np

from transformers.testing_utils import require_flax, require_tf, require_torch
from transformers.utils import (
    expand_dims,
    flatten_dict,
    is_flax_available,
    is_tf_available,
    is_torch_available,
    reshape,
    squeeze,
    transpose,
)


if is_flax_available():
					import jax.numpy as jnp

if is_tf_available():
					import tensorflow as tf

if is_torch_available():
					import torch







class     __lowerCAmelCase (       unittest.TestCase ):

			"""simple docstring"""







			def       lowercase_    (      self							)    ->      Tuple:



							'''simple docstring'''
							__lowerCamelCase		       =    {
							    'task_specific_params': {
							        'summarization': {'length_penalty': 1.0, 'max_length': 128, 'min_length': 12, 'num_beams': 4},
							        'summarization_cnn': {'length_penalty': 2.0, 'max_length': 142, 'min_length': 56, 'num_beams': 4},
							        'summarization_xsum': {'length_penalty': 1.0, 'max_length': 62, 'min_length': 11, 'num_beams': 6},
							    }
							}
							__lowerCamelCase		       =    {
							    'task_specific_params.summarization.length_penalty': 1.0,
							    'task_specific_params.summarization.max_length': 128,
							    'task_specific_params.summarization.min_length': 12,
							    'task_specific_params.summarization.num_beams': 4,
							    'task_specific_params.summarization_cnn.length_penalty': 2.0,
							    'task_specific_params.summarization_cnn.max_length': 142,
							    'task_specific_params.summarization_cnn.min_length': 56,
							    'task_specific_params.summarization_cnn.num_beams': 4,
							    'task_specific_params.summarization_xsum.length_penalty': 1.0,
							    'task_specific_params.summarization_xsum.max_length': 62,
							    'task_specific_params.summarization_xsum.min_length': 11,
							    'task_specific_params.summarization_xsum.num_beams': 6,
							}

							self.assertEqual(flatten_dict(lowerCamelCase__							)			,						lowerCamelCase__							)


			def       lowercase_    (      self							)    ->      Tuple:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__							)			,						x.transpose()							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__			,						axes=(1, 2, 0)							)			,						x.transpose((1, 2, 0)							)							)							)


			@require_torch
			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__							)			,						transpose(lowerCamelCase__							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__			,						axes=(1, 2, 0)							)			,						transpose(lowerCamelCase__			,						axes=(1, 2, 0)							).numpy()							)							)


			@require_tf
			def       lowercase_    (      self							)    ->      Union[str, Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__							)			,						transpose(lowerCamelCase__							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__			,						axes=(1, 2, 0)							)			,						transpose(lowerCamelCase__			,						axes=(1, 2, 0)							).numpy()							)							)


			@require_flax
			def       lowercase_    (      self							)    ->      Optional[int]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__							)			,						np.asarray(transpose(lowerCamelCase__							)							)							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(transpose(lowerCamelCase__			,						axes=(1, 2, 0)							)			,						np.asarray(transpose(lowerCamelCase__			,						axes=(1, 2, 0)							)							)							)							)


			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(4, 3)							)			,						np.reshape(lowerCamelCase__			,						(4, 3)							)							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(12, 5)							)			,						np.reshape(lowerCamelCase__			,						(12, 5)							)							)							)


			@require_torch
			def       lowercase_    (      self							)    ->      List[Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(4, 3)							)			,						reshape(lowerCamelCase__			,						(4, 3)							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(12, 5)							)			,						reshape(lowerCamelCase__			,						(12, 5)							).numpy()							)							)


			@require_tf
			def       lowercase_    (      self							)    ->      Optional[int]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(4, 3)							)			,						reshape(lowerCamelCase__			,						(4, 3)							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(12, 5)							)			,						reshape(lowerCamelCase__			,						(12, 5)							).numpy()							)							)


			@require_flax
			def       lowercase_    (      self							)    ->      Tuple:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(4, 3)							)			,						np.asarray(reshape(lowerCamelCase__			,						(4, 3)							)							)							)							)

							__lowerCamelCase		       =    np.random.randn(3			,						4			,						5							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(reshape(lowerCamelCase__			,						(12, 5)							)			,						np.asarray(reshape(lowerCamelCase__			,						(12, 5)							)							)							)							)


			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(1			,						3			,						4							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__							)			,						np.squeeze(lowerCamelCase__							)							)							)

							__lowerCamelCase		       =    np.random.randn(1			,						4			,						1			,						5							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__			,						axis=2							)			,						np.squeeze(lowerCamelCase__			,						axis=2							)							)							)


			@require_torch
			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(1			,						3			,						4							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__							)			,						squeeze(lowerCamelCase__							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(1			,						4			,						1			,						5							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__			,						axis=2							)			,						squeeze(lowerCamelCase__			,						axis=2							).numpy()							)							)


			@require_tf
			def       lowercase_    (      self							)    ->      Union[str, Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(1			,						3			,						4							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__							)			,						squeeze(lowerCamelCase__							).numpy()							)							)

							__lowerCamelCase		       =    np.random.randn(1			,						4			,						1			,						5							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__			,						axis=2							)			,						squeeze(lowerCamelCase__			,						axis=2							).numpy()							)							)


			@require_flax
			def       lowercase_    (      self							)    ->      List[str]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(1			,						3			,						4							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__							)			,						np.asarray(squeeze(lowerCamelCase__							)							)							)							)

							__lowerCamelCase		       =    np.random.randn(1			,						4			,						1			,						5							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(squeeze(lowerCamelCase__			,						axis=2							)			,						np.asarray(squeeze(lowerCamelCase__			,						axis=2							)							)							)							)


			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							self.assertTrue(np.allclose(expand_dims(lowerCamelCase__			,						axis=1							)			,						np.expand_dims(lowerCamelCase__			,						axis=1							)							)							)


			@require_torch
			def       lowercase_    (      self							)    ->      Any:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    torch.tensor(lowerCamelCase__							)
							self.assertTrue(np.allclose(expand_dims(lowerCamelCase__			,						axis=1							)			,						expand_dims(lowerCamelCase__			,						axis=1							).numpy()							)							)


			@require_tf
			def       lowercase_    (      self							)    ->      Any:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    tf.constant(lowerCamelCase__							)
							self.assertTrue(np.allclose(expand_dims(lowerCamelCase__			,						axis=1							)			,						expand_dims(lowerCamelCase__			,						axis=1							).numpy()							)							)






			@require_flax
			def       lowercase_    (      self							)    ->      List[Any]:



							'''simple docstring'''
							__lowerCamelCase		       =    np.random.randn(3			,						4							)
							__lowerCamelCase		       =    jnp.array(lowerCamelCase__							)
							self.assertTrue(np.allclose(expand_dims(lowerCamelCase__			,						axis=1							)			,						np.asarray(expand_dims(lowerCamelCase__			,						axis=1							)							)							)							)


