"""simple docstring"""







import unittest

import torch

from diffusers import UNetaDModel
from diffusers.utils import floats_tensor, slow, torch_device

from .test_modeling_common import ModelTesterMixin, UNetTesterMixin






class 							__snake_case(					a__				,	a__				,	unittest.TestCase	):


    '''simple docstring'''





    _UpperCAmelCase       =			UNetaDModel
    _UpperCAmelCase       =			"""sample"""
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					str								=		4
         __A					:					Dict								=		14
         __A					:					List[Any]								=		16

         __A					:					Union[str, Any]								=		floats_tensor((batch_size, num_features, seq_len)	).to(lowercase__	)
         __A					:					Union[str, Any]								=		torch.tensor([10] * batch_size	).to(lowercase__	)

         return {"sample": noise, "timestep": time_step}
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         return (4, 14, 16)
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         return (4, 14, 16)
    def 						_a							(  self	):




         '''simple docstring'''



         pass
    def 						_a							(  self	):




         '''simple docstring'''



         pass
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_determinism()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_outputs_equivalence()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_from_save_pretrained()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_from_save_pretrained_variant()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_model_from_pretrained()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_output()
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Any								=		{
             '''block_out_channels''': (32, 64, 128, 256),
             '''in_channels''': 14,
             '''out_channels''': 14,
             '''time_embedding_type''': '''positional''',
             '''use_timestep_embedding''': True,
             '''flip_sin_to_cos''': False,
             '''freq_shift''': 1.0,
             '''out_block_type''': '''OutConv1DBlock''',
             '''mid_block_type''': '''MidResTemporalBlock1D''',
             '''down_block_types''': ('''DownResnetBlock1D''', '''DownResnetBlock1D''', '''DownResnetBlock1D''', '''DownResnetBlock1D'''),
             '''up_block_types''': ('''UpResnetBlock1D''', '''UpResnetBlock1D''', '''UpResnetBlock1D'''),
             '''act_fn''': '''mish''',
         }
         __A					:					Union[str, Any]								=		self.dummy_input
         return init_dict, inputs_dict
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Optional[Any]								=		UNetaDModel.from_pretrained(
             'bglick13/hopper-medium-v2-value-function-hor32'					,       output_loading_info=lowercase__					,       subfolder='unet'	)
         self.assertIsNotNone(lowercase__	)
         self.assertEqual(len(loading_info['missing_keys']	)					,       0	)

         model.to(lowercase__	)
         __A					:					Optional[int]								=		model(**self.dummy_input	)

         assert image is not None, "Make sure output is not None"
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[str]								=		UNetaDModel.from_pretrained('bglick13/hopper-medium-v2-value-function-hor32'					,       subfolder='unet'	)
         torch.manual_seed(0	)
         if torch.cuda.is_available():
              torch.cuda.manual_seed_all(0	)

         __A					:					Optional[int]								=		model.config.in_channels
         __A					:					Tuple								=		16
         __A					:					str								=		torch.randn((1, seq_len, num_features)	).permute(
             0					,       2					,       1	)  # match original, we can update values and remove
         __A					:					str								=		torch.full((num_features,)					,       0	)

         with torch.no_grad():
              __A					:					Optional[Any]								=		model(lowercase__					,       lowercase__	).sample.permute(0					,       2					,       1	)

         __A					:					Optional[int]								=		output[0, -3:, -3:].flatten()
         # fmt: off
         __A					:					int								=		torch.tensor([-2.13_71_72, 1.1_42_60_16, 0.3_68_86_87, -0.76_69_22, 0.7_30_31_46, 0.11_03_88_64, -0.4_76_06_33, 0.13_27_01_72, 0.02_59_13_48]	)
         # fmt: on
         self.assertTrue(torch.allclose(lowercase__					,       lowercase__					,       rtol=1e-3	)	)
    def 						_a							(  self	):




         '''simple docstring'''



         pass

    @slow
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Tuple								=		'''harmonai/maestro-150k'''
         __A					:					List[str]								=		UNetaDModel.from_pretrained(lowercase__					,       subfolder='unet'	)
         model.to(lowercase__	)

         __A					:					List[Any]								=		65536
         __A					:					str								=		torch.sin(torch.arange(lowercase__	)[None, None, :].repeat(1					,       2					,       1	)	).to(lowercase__	)
         __A					:					Optional[Any]								=		torch.tensor([1]	).to(lowercase__	)

         with torch.no_grad():
              __A					:					Optional[int]								=		model(lowercase__					,       lowercase__	).sample

         __A					:					int								=		output.abs().sum()
         __A					:					List[str]								=		output.abs().max()

         assert (output_sum - 2_24.08_96).abs() < 0.5
         assert (output_max - 0.06_07).abs() < 4e-4







class 							__snake_case(					a__				,	a__				,	unittest.TestCase	):


    '''simple docstring'''





    _UpperCAmelCase       =			UNetaDModel
    _UpperCAmelCase       =			"""sample"""
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[Any]								=		4
         __A					:					str								=		14
         __A					:					Optional[int]								=		16

         __A					:					Optional[int]								=		floats_tensor((batch_size, num_features, seq_len)	).to(lowercase__	)
         __A					:					Any								=		torch.tensor([10] * batch_size	).to(lowercase__	)

         return {"sample": noise, "timestep": time_step}
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         return (4, 14, 16)
    @property
    def 						_a							(  self	):




         '''simple docstring'''



         return (4, 14, 1)
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_determinism()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_outputs_equivalence()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_from_save_pretrained()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_from_save_pretrained_variant()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         super().test_model_from_pretrained()
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[Any]								=		self.prepare_init_args_and_inputs_for_common()
         __A					:					Optional[int]								=		self.model_class(**lowercase__	)
         model.to(lowercase__	)
         model.eval()

         with torch.no_grad():
              __A					:					Dict								=		model(**lowercase__	)

              if isinstance(lowercase__					,       lowercase__	):
                   __A					:					Optional[Any]								=		output.sample

         self.assertIsNotNone(lowercase__	)
         __A					:					List[str]								=		torch.Size((inputs_dict['sample'].shape[0], 1)	)
         self.assertEqual(output.shape					,       lowercase__					,       'Input and output shapes do not match'	)
    def 						_a							(  self	):




         '''simple docstring'''



         pass
    def 						_a							(  self	):




         '''simple docstring'''



         pass
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Tuple								=		{
             '''in_channels''': 14,
             '''out_channels''': 14,
             '''down_block_types''': ['''DownResnetBlock1D''', '''DownResnetBlock1D''', '''DownResnetBlock1D''', '''DownResnetBlock1D'''],
             '''up_block_types''': [],
             '''out_block_type''': '''ValueFunction''',
             '''mid_block_type''': '''ValueFunctionMidBlock1D''',
             '''block_out_channels''': [32, 64, 128, 256],
             '''layers_per_block''': 1,
             '''downsample_each_block''': True,
             '''use_timestep_embedding''': True,
             '''freq_shift''': 1.0,
             '''flip_sin_to_cos''': False,
             '''time_embedding_type''': '''positional''',
             '''act_fn''': '''mish''',
         }
         __A					:					Union[str, Any]								=		self.dummy_input
         return init_dict, inputs_dict
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					Any								=		UNetaDModel.from_pretrained(
             'bglick13/hopper-medium-v2-value-function-hor32'					,       output_loading_info=lowercase__					,       subfolder='value_function'	)
         self.assertIsNotNone(lowercase__	)
         self.assertEqual(len(vf_loading_info['missing_keys']	)					,       0	)

         value_function.to(lowercase__	)
         __A					:					Union[str, Any]								=		value_function(**self.dummy_input	)

         assert image is not None, "Make sure output is not None"
    @unittest.skipIf(torch_device == 'mps'					,       'mish op not supported in MPS'	)
    def 						_a							(  self	):




         '''simple docstring'''



         __A					:					List[Any]								=		UNetaDModel.from_pretrained(
             'bglick13/hopper-medium-v2-value-function-hor32'					,       output_loading_info=lowercase__					,       subfolder='value_function'	)
         torch.manual_seed(0	)
         if torch.cuda.is_available():
              torch.cuda.manual_seed_all(0	)

         __A					:					List[Any]								=		value_function.config.in_channels
         __A					:					Any								=		14
         __A					:					int								=		torch.randn((1, seq_len, num_features)	).permute(
             0					,       2					,       1	)  # match original, we can update values and remove
         __A					:					Optional[Any]								=		torch.full((num_features,)					,       0	)

         with torch.no_grad():
              __A					:					int								=		value_function(lowercase__					,       lowercase__	).sample

         # fmt: off
         __A					:					Union[str, Any]								=		torch.tensor([1_65.25] * seq_len	)
         # fmt: on
         self.assertTrue(torch.allclose(lowercase__					,       lowercase__					,       rtol=1e-3	)	)

    def 						_a							(  self	):




         '''simple docstring'''



         pass










'''simple docstring'''

from __future__ import annotations

import inspect
import unittest
from typing import List, Tuple

from transformers import ConvNextConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_available

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


if is_tf_available():
   import tensorflow as tf

   from transformers import TFConvNextForImageClassification, TFConvNextModel


if is_vision_available():
   from PIL import Image

   from transformers import ConvNextImageProcessor





class lowerCamelCase    :







  def __init__(		self  ,  lowercase__  ,  lowercase__=13  ,  lowercase__=32  ,  lowercase__=3  ,  lowercase__=4  ,  lowercase__=[10, 20, 30, 40]  ,  lowercase__=[2, 2, 3, 2]  ,  lowercase__=True  ,  lowercase__=True  ,  lowercase__=37  ,  lowercase__="gelu"  ,  lowercase__=10  ,  lowercase__=0.02  ,  lowercase__=3  ,  lowercase__=None  ,  )		->    Any:






        """simple docstring"""





        _snake_case		:						str         =  parent
        _snake_case		:						Any         =  batch_size
        _snake_case		:						Optional[Any]         =  image_size
        _snake_case		:						List[Any]         =  num_channels
        _snake_case		:						int         =  num_stages
        _snake_case		:						Any         =  hidden_sizes
        _snake_case		:						Dict         =  depths
        _snake_case		:						List[Any]         =  is_training
        _snake_case		:						Union[str, Any]         =  use_labels
        _snake_case		:						Dict         =  intermediate_size
        _snake_case		:						List[str]         =  hidden_act
        _snake_case		:						Optional[int]         =  type_sequence_label_size
        _snake_case		:						str         =  initializer_range
        _snake_case		:						Dict         =  scope







  def 					UpperCAmelCase_					(		self		)		->    List[str]:






        """simple docstring"""





        _snake_case		:						Dict         =  floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]		)

        _snake_case		:						int         =  None
        if self.use_labels:
              _snake_case		:						Optional[int]         =  ids_tensor([self.batch_size]  ,  self.type_sequence_label_size		)

        _snake_case		:						Union[str, Any]         =  self.get_config()

        return config, pixel_values, labels







  def 					UpperCAmelCase_					(		self		)		->    Union[str, Any]:






        """simple docstring"""





        return ConvNextConfig(
            num_channels=self.num_channels  ,  hidden_sizes=self.hidden_sizes  ,  depths=self.depths  ,  num_stages=self.num_stages  ,  hidden_act=self.hidden_act  ,  is_decoder=lowercase__  ,  initializer_range=self.initializer_range  ,  )







  def 					UpperCAmelCase_					(		self  ,  lowercase__  ,  lowercase__  ,  lowercase__		)		->    int:






        """simple docstring"""





        _snake_case		:						Tuple         =  TFConvNextModel(config=lowercase__		)
        _snake_case		:						Optional[int]         =  model(lowercase__  ,  training=lowercase__		)
        # expected last hidden states: B, C, H // 32, W // 32
        self.parent.assertEqual(
            result.last_hidden_state.shape  ,  (self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32)  ,  )







  def 					UpperCAmelCase_					(		self  ,  lowercase__  ,  lowercase__  ,  lowercase__		)		->    Optional[Any]:






        """simple docstring"""





        _snake_case		:						int         =  self.type_sequence_label_size
        _snake_case		:						Optional[int]         =  TFConvNextForImageClassification(lowercase__		)
        _snake_case		:						Dict         =  model(lowercase__  ,  labels=lowercase__  ,  training=lowercase__		)
        self.parent.assertEqual(result.logits.shape  ,  (self.batch_size, self.type_sequence_label_size)		)







  def 					UpperCAmelCase_					(		self		)		->    List[str]:






        """simple docstring"""





        _snake_case		:						Union[str, Any]         =  self.prepare_config_and_inputs()
        _snake_case  ,				_snake_case  ,				_snake_case		:						Union[str, Any]         =  config_and_inputs
        _snake_case		:						Optional[Any]         =  {'''pixel_values''': pixel_values}
        return config, inputs_dict





@require_tf
class lowerCamelCase    (a__    ,   a__    ,   unittest.TestCase       ):
  _lowercase	:						str							       =					(TFConvNextModel, TFConvNextForImageClassification) if is_tf_available() else ()
  _lowercase	:						List[str]							       =					(
      {"""feature-extraction""": TFConvNextModel, """image-classification""": TFConvNextForImageClassification}
      if is_tf_available()
      else {}
  )

  _lowercase	:						Optional[Any]							       =					False
  _lowercase	:						str							       =					False
  _lowercase	:						Tuple							       =					False
  _lowercase	:						Union[str, Any]							       =					False
  _lowercase	:						Dict							       =					False







  def 					UpperCAmelCase_					(		self		)		->    Any:






        """simple docstring"""





        _snake_case		:						List[str]         =  TFConvNextModelTester(self		)
        _snake_case		:						Tuple         =  ConfigTester(
            self  ,  config_class=lowercase__  ,  has_text_modality=lowercase__  ,  hidden_size=37  ,  )







  @unittest.skip(reason='''ConvNext does not use inputs_embeds'''		)
  def 					UpperCAmelCase_					(		self		)		->    int:






        """simple docstring"""





        pass







  @unittest.skipIf(
      not is_tf_available() or len(tf.config.list_physical_devices('''GPU'''		)		) == 0  ,  reason='''TF does not support backprop for grouped convolutions on CPU.'''  ,  )
  @slow
  def 					UpperCAmelCase_					(		self		)		->    int:






        """simple docstring"""





        super().test_keras_fit()







  @unittest.skip(reason='''ConvNext does not support input and output embeddings'''		)
  def 					UpperCAmelCase_					(		self		)		->    Any:






        """simple docstring"""





        pass







  def 					UpperCAmelCase_					(		self		)		->    Any:






        """simple docstring"""





        _snake_case  ,				_snake_case		:						Dict         =  self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
              _snake_case		:						int         =  model_class(lowercase__		)
              _snake_case		:						Dict         =  inspect.signature(model.call		)
              # signature.parameters is an OrderedDict => so arg_names order is deterministic
              _snake_case		:						Optional[int]         =  [*signature.parameters.keys()]

              _snake_case		:						int         =  ['''pixel_values''']
              self.assertListEqual(arg_names[:1]  ,  lowercase__		)







  def 					UpperCAmelCase_					(		self		)		->    str:






        """simple docstring"""





        _snake_case		:						Dict         =  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*lowercase__		)







  @unittest.skipIf(
      not is_tf_available() or len(tf.config.list_physical_devices('''GPU'''		)		) == 0  ,  reason='''TF does not support backprop for grouped convolutions on CPU.'''  ,  )
  def 					UpperCAmelCase_					(		self		)		->    Optional[Any]:






        """simple docstring"""





        super().test_dataset_conversion()







  def 					UpperCAmelCase_					(		self		)		->    List[str]:






        """simple docstring"""





        def check_hidden_states_output(lowercase__  ,  lowercase__  ,  lowercase__		):
              _snake_case		:						List[Any]         =  model_class(lowercase__		)

              _snake_case		:						Dict         =  model(**self._prepare_for_class(lowercase__  ,  lowercase__		)		)
              _snake_case		:						str         =  outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

              _snake_case		:						List[Any]         =  self.model_tester.num_stages
              self.assertEqual(len(lowercase__		)  ,  expected_num_stages + 1		)

              # ConvNext's feature maps are of shape (batch_size, num_channels, height, width)
              self.assertListEqual(
                  list(hidden_states[0].shape[-2:]		)  ,  [self.model_tester.image_size // 4, self.model_tester.image_size // 4]  ,  )

        _snake_case  ,				_snake_case		:						Optional[Any]         =  self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
              _snake_case		:						int         =  True
              check_hidden_states_output(lowercase__  ,  lowercase__  ,  lowercase__		)

              # check that output_hidden_states also work using config
              del inputs_dict["output_hidden_states"]
              _snake_case		:						Any         =  True

              check_hidden_states_output(lowercase__  ,  lowercase__  ,  lowercase__		)







  def 					UpperCAmelCase_					(		self		)		->    Any:






        """simple docstring"""





        _snake_case  ,				_snake_case		:						Dict         =  self.model_tester.prepare_config_and_inputs_for_common()

        def check_equivalence(lowercase__  ,  lowercase__  ,  lowercase__  ,  lowercase__={}		):
              _snake_case		:						Tuple         =  model(lowercase__  ,  return_dict=lowercase__  ,  **lowercase__		)
              _snake_case		:						Any         =  model(lowercase__  ,  return_dict=lowercase__  ,  **lowercase__		).to_tuple()

              def recursive_check(lowercase__  ,  lowercase__		):
                    if isinstance(lowercase__  ,  (List, Tuple)		):
                          for tuple_iterable_value, dict_iterable_value in zip(lowercase__  ,  lowercase__		):
                                recursive_check(lowercase__  ,  lowercase__		)
                    elif tuple_object is None:
                          return
                    else:
                          self.assertTrue(
                              all(tf.equal(lowercase__  ,  lowercase__		)		)  ,  msg=(
                                  '''Tuple and dict output are not equal. Difference:'''
                                  F''' {tf.math.reduce_max(tf.abs(tuple_object - dict_object		)		)}'''
                              )  ,  )

                    recursive_check(lowercase__  ,  lowercase__		)

        for model_class in self.all_model_classes:
              _snake_case		:						Dict         =  model_class(lowercase__		)

              _snake_case		:						Union[str, Any]         =  self._prepare_for_class(lowercase__  ,  lowercase__		)
              _snake_case		:						str         =  self._prepare_for_class(lowercase__  ,  lowercase__		)
              check_equivalence(lowercase__  ,  lowercase__  ,  lowercase__		)

              _snake_case		:						List[Any]         =  self._prepare_for_class(lowercase__  ,  lowercase__  ,  return_labels=lowercase__		)
              _snake_case		:						Any         =  self._prepare_for_class(lowercase__  ,  lowercase__  ,  return_labels=lowercase__		)
              check_equivalence(lowercase__  ,  lowercase__  ,  lowercase__		)

              _snake_case		:						List[str]         =  self._prepare_for_class(lowercase__  ,  lowercase__		)
              _snake_case		:						Union[str, Any]         =  self._prepare_for_class(lowercase__  ,  lowercase__		)
              check_equivalence(lowercase__  ,  lowercase__  ,  lowercase__  ,  {'''output_hidden_states''': True}		)

              _snake_case		:						Optional[int]         =  self._prepare_for_class(lowercase__  ,  lowercase__  ,  return_labels=lowercase__		)
              _snake_case		:						Any         =  self._prepare_for_class(lowercase__  ,  lowercase__  ,  return_labels=lowercase__		)
              check_equivalence(lowercase__  ,  lowercase__  ,  lowercase__  ,  {'''output_hidden_states''': True}		)







  def 					UpperCAmelCase_					(		self		)		->    Union[str, Any]:






        """simple docstring"""





        _snake_case		:						str         =  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_for_image_classification(*lowercase__		)







  @slow
  def 					UpperCAmelCase_					(		self		)		->    Optional[Any]:






        """simple docstring"""





        _snake_case		:						List[Any]         =  TFConvNextModel.from_pretrained('''facebook/convnext-tiny-224'''		)
        self.assertIsNotNone(lowercase__		)




def  _a     (				):





      """simple docstring"""



      _snake_case		:						List[str]         =  Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''						)
      return image





@require_tf
@require_vision
class lowerCamelCase    (unittest.TestCase       ):







  @cached_property
  def 					UpperCAmelCase_					(		self		)		->    Optional[int]:






        """simple docstring"""





        return ConvNextImageProcessor.from_pretrained('''facebook/convnext-tiny-224'''		) if is_vision_available() else None







  @slow
  def 					UpperCAmelCase_					(		self		)		->    Any:






        """simple docstring"""





        _snake_case		:						Dict         =  TFConvNextForImageClassification.from_pretrained('''facebook/convnext-tiny-224'''		)

        _snake_case		:						str         =  self.default_image_processor
        _snake_case		:						Optional[int]         =  prepare_img()
        _snake_case		:						str         =  image_processor(images=lowercase__  ,  return_tensors='''tf'''		)

        # forward pass
        _snake_case		:						Union[str, Any]         =  model(**lowercase__		)

        # verify the logits
        _snake_case		:						Union[str, Any]         =  tf.TensorShape((1, 1_000)		)
        self.assertEqual(outputs.logits.shape  ,  lowercase__		)

        _snake_case		:						List[str]         =  tf.constant([-0.0_260, -0.4_739, 0.1_911]		)

        tf.debugging.assert_near(outputs.logits[0, :3]  ,  lowercase__  ,  atol=1E-4		)


