




import shutil
import tempfile
import unittest

import numpy as np

from transformers.testing_utils import (
    is_pt_tf_cross_test,
    require_tf,
    require_torch,
    require_torchvision,
    require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_vision_available


if is_vision_available():
					from PIL import Image

					from transformers import AutoProcessor, SamImageProcessor, SamProcessor

if is_torch_available():
					import torch

if is_tf_available():
					import tensorflow as tf
@require_vision
@require_torchvision
class       a__   ( unittest.TestCase				):






						"""simple docstring"""




						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	tempfile.mkdtemp()
											__lowerCAmelCase           =	SamImageProcessor()
											__lowerCAmelCase           =	SamProcessor(_UpperCAmelCase      )
											processor.save_pretrained(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self		,      **_A      ):




											"""simple docstring"""



											return AutoProcessor.from_pretrained(self.tmpdirname		,      **_UpperCAmelCase      ).image_processor






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											shutil.rmtree(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	[np.random.randint(2_5_5		,      size=(3, 3_0, 4_0_0)		,      dtype=np.uinta      )]

											__lowerCAmelCase           =	[Image.fromarray(np.moveaxis(_UpperCAmelCase		,      0		,      -1      )      ) for x in image_inputs]

											return image_inputs






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	SamProcessor(image_processor=self.get_image_processor()      )
											processor.save_pretrained(self.tmpdirname      )

											__lowerCAmelCase           =	self.get_image_processor(do_normalize=_UpperCAmelCase		,      padding_value=1.0      )

											__lowerCAmelCase           =	SamProcessor.from_pretrained(self.tmpdirname		,      do_normalize=_UpperCAmelCase		,      padding_value=1.0      )

											self.assertEqual(processor.image_processor.to_json_string()		,      image_processor_add_kwargs.to_json_string()      )
											self.assertIsInstance(processor.image_processor		,      _UpperCAmelCase      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )

											__lowerCAmelCase           =	self.prepare_image_inputs()

											__lowerCAmelCase           =	image_processor(_UpperCAmelCase		,      return_tensors="np"      )
											__lowerCAmelCase           =	processor(images=_UpperCAmelCase		,      return_tensors="np"      )

											input_feat_extract.pop("original_sizes"      )  # pop original_sizes as it is popped in the processor
											input_feat_extract.pop("reshaped_input_sizes"      )  # pop original_sizes as it is popped in the processor

											for key in input_feat_extract.keys():
																self.assertAlmostEqual(input_feat_extract[key].sum()		,      input_processor[key].sum()		,      delta=1E-2      )






						@require_torch
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )
											__lowerCAmelCase           =	[torch.ones((1, 3, 5, 5)      )]

											__lowerCAmelCase           =	[[1_7_6_4, 2_6_4_6]]

											__lowerCAmelCase           =	[[6_8_3, 1_0_2_4]]
											__lowerCAmelCase           =	processor.post_process_masks(_UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase      )
											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											__lowerCAmelCase           =	processor.post_process_masks(
											    _UpperCAmelCase		,      torch.tensor(_UpperCAmelCase      )		,      torch.tensor(_UpperCAmelCase      )      )
											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											# should also work with np
											__lowerCAmelCase           =	[np.ones((1, 3, 5, 5)      )]
											__lowerCAmelCase           =	processor.post_process_masks(_UpperCAmelCase		,      np.array(_UpperCAmelCase      )		,      np.array(_UpperCAmelCase      )      )

											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											__lowerCAmelCase           =	[[1, 0], [0, 1]]
											with self.assertRaises(_UpperCAmelCase      ):
																__lowerCAmelCase           =	processor.post_process_masks(_UpperCAmelCase		,      np.array(_UpperCAmelCase      )		,      np.array(_UpperCAmelCase      )      )






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






						"""simple docstring"""




						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	tempfile.mkdtemp()
											__lowerCAmelCase           =	SamImageProcessor()
											__lowerCAmelCase           =	SamProcessor(_UpperCAmelCase      )
											processor.save_pretrained(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self		,      **_A      ):




											"""simple docstring"""



											return AutoProcessor.from_pretrained(self.tmpdirname		,      **_UpperCAmelCase      ).image_processor






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											shutil.rmtree(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	[np.random.randint(2_5_5		,      size=(3, 3_0, 4_0_0)		,      dtype=np.uinta      )]

											__lowerCAmelCase           =	[Image.fromarray(np.moveaxis(_UpperCAmelCase		,      0		,      -1      )      ) for x in image_inputs]

											return image_inputs






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	SamProcessor(image_processor=self.get_image_processor()      )
											processor.save_pretrained(self.tmpdirname      )

											__lowerCAmelCase           =	self.get_image_processor(do_normalize=_UpperCAmelCase		,      padding_value=1.0      )

											__lowerCAmelCase           =	SamProcessor.from_pretrained(self.tmpdirname		,      do_normalize=_UpperCAmelCase		,      padding_value=1.0      )

											self.assertEqual(processor.image_processor.to_json_string()		,      image_processor_add_kwargs.to_json_string()      )
											self.assertIsInstance(processor.image_processor		,      _UpperCAmelCase      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )

											__lowerCAmelCase           =	self.prepare_image_inputs()

											__lowerCAmelCase           =	image_processor(_UpperCAmelCase		,      return_tensors="np"      )
											__lowerCAmelCase           =	processor(images=_UpperCAmelCase		,      return_tensors="np"      )

											input_feat_extract.pop("original_sizes"      )  # pop original_sizes as it is popped in the processor
											input_feat_extract.pop("reshaped_input_sizes"      )  # pop reshaped_input_sizes as it is popped in the processor

											for key in input_feat_extract.keys():
																self.assertAlmostEqual(input_feat_extract[key].sum()		,      input_processor[key].sum()		,      delta=1E-2      )






						@require_tf
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )
											__lowerCAmelCase           =	[tf.ones((1, 3, 5, 5)      )]

											__lowerCAmelCase           =	[[1_7_6_4, 2_6_4_6]]

											__lowerCAmelCase           =	[[6_8_3, 1_0_2_4]]
											__lowerCAmelCase           =	processor.post_process_masks(_UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase		,      return_tensors="tf"      )
											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											__lowerCAmelCase           =	processor.post_process_masks(
											    _UpperCAmelCase		,      tf.convert_to_tensor(_UpperCAmelCase      )		,      tf.convert_to_tensor(_UpperCAmelCase      )		,      return_tensors="tf"		,      )
											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											# should also work with np
											__lowerCAmelCase           =	[np.ones((1, 3, 5, 5)      )]
											__lowerCAmelCase           =	processor.post_process_masks(
											    _UpperCAmelCase		,      np.array(_UpperCAmelCase      )		,      np.array(_UpperCAmelCase      )		,      return_tensors="tf"      )

											self.assertEqual(masks[0].shape		,      (1, 3, 1_7_6_4, 2_6_4_6)      )

											__lowerCAmelCase           =	[[1, 0], [0, 1]]
											with self.assertRaises(tf.errors.InvalidArgumentError      ):
																__lowerCAmelCase           =	processor.post_process_masks(
																    _UpperCAmelCase		,      np.array(_UpperCAmelCase      )		,      np.array(_UpperCAmelCase      )		,      return_tensors="tf"      )






@require_vision
@require_torchvision
class       a__   ( unittest.TestCase				):






						"""simple docstring"""




						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	tempfile.mkdtemp()
											__lowerCAmelCase           =	SamImageProcessor()
											__lowerCAmelCase           =	SamProcessor(_UpperCAmelCase      )
											processor.save_pretrained(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self		,      **_A      ):




											"""simple docstring"""



											return AutoProcessor.from_pretrained(self.tmpdirname		,      **_UpperCAmelCase      ).image_processor






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											shutil.rmtree(self.tmpdirname      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	[np.random.randint(2_5_5		,      size=(3, 3_0, 4_0_0)		,      dtype=np.uinta      )]

											__lowerCAmelCase           =	[Image.fromarray(np.moveaxis(_UpperCAmelCase		,      0		,      -1      )      ) for x in image_inputs]

											return image_inputs






						@is_pt_tf_cross_test
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )
											__lowerCAmelCase           =	np.random.randint(0		,      2		,      size=(1, 3, 5, 5)      ).astype(np.floataa      )
											__lowerCAmelCase           =	[tf.convert_to_tensor(_UpperCAmelCase      )]
											__lowerCAmelCase           =	[torch.tensor(_UpperCAmelCase      )]

											__lowerCAmelCase           =	[[1_7_6_4, 2_6_4_6]]

											__lowerCAmelCase           =	[[6_8_3, 1_0_2_4]]
											__lowerCAmelCase           =	processor.post_process_masks(
											    _UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase		,      return_tensors="tf"      )
											__lowerCAmelCase           =	processor.post_process_masks(
											    _UpperCAmelCase		,      _UpperCAmelCase		,      _UpperCAmelCase		,      return_tensors="pt"      )

											self.assertTrue(np.all(tf_masks[0].numpy() == pt_masks[0].numpy()      )      )






						@is_pt_tf_cross_test
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.get_image_processor()

											__lowerCAmelCase           =	SamProcessor(image_processor=_UpperCAmelCase      )

											__lowerCAmelCase           =	self.prepare_image_inputs()

											__lowerCAmelCase           =	image_processor(_UpperCAmelCase		,      return_tensors="pt"      )['pixel_values'].numpy()
											__lowerCAmelCase           =	processor(images=_UpperCAmelCase		,      return_tensors="pt"      )['pixel_values'].numpy()

											__lowerCAmelCase           =	image_processor(_UpperCAmelCase		,      return_tensors="tf"      )['pixel_values'].numpy()
											__lowerCAmelCase           =	processor(images=_UpperCAmelCase		,      return_tensors="tf"      )['pixel_values'].numpy()

											self.assertTrue(np.allclose(_UpperCAmelCase		,      _UpperCAmelCase      )      )
											self.assertTrue(np.allclose(_UpperCAmelCase		,      _UpperCAmelCase      )      )
											self.assertTrue(np.allclose(_UpperCAmelCase		,      _UpperCAmelCase      )      )










from __future__ import annotations

import inspect
import unittest

import numpy as np

from transformers import DeiTConfig
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 (
					    TFDeiTForImageClassification,
					    TFDeiTForImageClassificationWithTeacher,
					    TFDeiTForMaskedImageModeling,
					    TFDeiTModel,
					)
					from transformers.models.deit.modeling_tf_deit import TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
					from PIL import Image

					from transformers import DeiTImageProcessor
class       a__   :






						def __init__(       self		,      _A		,      _A=1_3		,      _A=3_0		,      _A=2		,      _A=3		,      _A=True		,      _A=True		,      _A=3_2		,      _A=2		,      _A=4		,      _A=3_7		,      _A="gelu"		,      _A=0.1		,      _A=0.1		,      _A=1_0		,      _A=0.02		,      _A=3		,      _A=None		,      _A=2		,      ):




											"""simple docstring"""



											__lowerCAmelCase           =	parent
											__lowerCAmelCase           =	batch_size
											__lowerCAmelCase           =	image_size
											__lowerCAmelCase           =	patch_size
											__lowerCAmelCase           =	num_channels
											__lowerCAmelCase           =	is_training
											__lowerCAmelCase           =	use_labels
											__lowerCAmelCase           =	hidden_size
											__lowerCAmelCase           =	num_hidden_layers
											__lowerCAmelCase           =	num_attention_heads
											__lowerCAmelCase           =	intermediate_size
											__lowerCAmelCase           =	hidden_act
											__lowerCAmelCase           =	hidden_dropout_prob
											__lowerCAmelCase           =	attention_probs_dropout_prob
											__lowerCAmelCase           =	type_sequence_label_size
											__lowerCAmelCase           =	initializer_range
											__lowerCAmelCase           =	scope
											__lowerCAmelCase           =	encoder_stride

											# in DeiT, the seq length equals the number of patches + 2 (we add 2 for the [CLS] and distilation tokens)
											__lowerCAmelCase           =	(image_size // patch_size) ** 2
											__lowerCAmelCase           =	num_patches + 2






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



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

											__lowerCAmelCase           =	None
											if self.use_labels:
																__lowerCAmelCase           =	ids_tensor([self.batch_size]		,      self.type_sequence_label_size      )

											__lowerCAmelCase           =	self.get_config()

											return config, pixel_values, labels






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											return DeiTConfig(
											    image_size=self.image_size		,      patch_size=self.patch_size		,      num_channels=self.num_channels		,      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		,      is_decoder=_A		,      initializer_range=self.initializer_range		,      encoder_stride=self.encoder_stride		,      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	TFDeiTModel(config=_A      )
											__lowerCAmelCase           =	model(_A      )
											self.parent.assertEqual(result.last_hidden_state.shape		,      (self.batch_size, self.seq_length, self.hidden_size)      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	TFDeiTForMaskedImageModeling(config=_A      )
											__lowerCAmelCase           =	model(_A      )
											self.parent.assertEqual(
											    result.reconstruction.shape		,      (self.batch_size, self.num_channels, self.image_size, self.image_size)      )

											# test greyscale images
											__lowerCAmelCase           =	1
											__lowerCAmelCase           =	TFDeiTForMaskedImageModeling(_A      )

											__lowerCAmelCase           =	floats_tensor([self.batch_size, 1, self.image_size, self.image_size]      )
											__lowerCAmelCase           =	model(_A      )
											self.parent.assertEqual(result.reconstruction.shape		,      (self.batch_size, 1, self.image_size, self.image_size)      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.type_sequence_label_size
											__lowerCAmelCase           =	TFDeiTForImageClassification(_A      )
											__lowerCAmelCase           =	model(_A		,      labels=_A      )
											self.parent.assertEqual(result.logits.shape		,      (self.batch_size, self.type_sequence_label_size)      )

											# test greyscale images
											__lowerCAmelCase           =	1
											__lowerCAmelCase           =	TFDeiTForImageClassification(_A      )

											__lowerCAmelCase           =	floats_tensor([self.batch_size, 1, self.image_size, self.image_size]      )
											__lowerCAmelCase           =	model(_A		,      labels=_A      )
											self.parent.assertEqual(result.logits.shape		,      (self.batch_size, self.type_sequence_label_size)      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.prepare_config_and_inputs()
											__lowerCAmelCase       ,							__lowerCAmelCase       ,							__lowerCAmelCase           =	config_and_inputs
											__lowerCAmelCase           =	{"pixel_values": pixel_values}
											return config, inputs_dict






@require_tf
class       a__   ( snake_case__			,    snake_case__			,    unittest.TestCase				):
						_a							:   Optional[Any] =   (
						    (
						        TFDeiTModel,
						        TFDeiTForImageClassification,
						        TFDeiTForImageClassificationWithTeacher,
						        TFDeiTForMaskedImageModeling,
						    )
						    if is_tf_available()
						    else ()
						)
						_a							:   Optional[Any] =   (
						    {
						        """feature-extraction""": TFDeiTModel,
						        """image-classification""": (TFDeiTForImageClassification, TFDeiTForImageClassificationWithTeacher),
						    }
						    if is_tf_available()
						    else {}
						)

						_a							:   str =   False
						_a							:   str =   False
						_a							:   List[str] =   False
						_a							:   Optional[int] =   False






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	TFDeiTModelTester(self      )
											__lowerCAmelCase           =	ConfigTester(self		,      config_class=_A		,      has_text_modality=_A		,      hidden_size=3_7      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											self.config_tester.run_common_tests()






						@unittest.skip(reason="DeiT does not use inputs_embeds"      )
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											pass






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase       ,							__lowerCAmelCase           =	self.model_tester.prepare_config_and_inputs_for_common()

											for model_class in self.all_model_classes:
																__lowerCAmelCase           =	model_class(_A      )
																self.assertIsInstance(model.get_input_embeddings()		,      (tf.keras.layers.Layer)      )
																__lowerCAmelCase           =	model.get_output_embeddings()
																self.assertTrue(x is None or isinstance(_A		,      tf.keras.layers.Dense      )      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase       ,							__lowerCAmelCase           =	self.model_tester.prepare_config_and_inputs_for_common()

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

																__lowerCAmelCase           =	["pixel_values"]
																self.assertListEqual(arg_names[:1]		,      _A      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_A      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_image_modeling(*_A      )






						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_image_classification(*_A      )






						def     __SCREAMING_SNAKE_CASE(       self		,      _A		,      _A		,      _A=False      ):




											"""simple docstring"""



											__lowerCAmelCase           =	super()._prepare_for_class(_A		,      _A		,      return_labels=_A      )

											if return_labels:
																if "labels" in inputs_dict and "labels" not in inspect.signature(model_class.call      ).parameters:
																					del inputs_dict["labels"]

											return inputs_dict






						@slow
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											for model_name in TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																__lowerCAmelCase           =	TFDeiTModel.from_pretrained(_A      )
																self.assertIsNotNone(_A      )







def      _a				(						):
					__lowerCAmelCase           =	Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"					)
					return image


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






						@cached_property
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											return (
											    DeiTImageProcessor.from_pretrained("facebook/deit-base-distilled-patch16-224"      )
											    if is_vision_available()
											    else None
											)






						@slow
						def     __SCREAMING_SNAKE_CASE(       self      ):




											"""simple docstring"""



											__lowerCAmelCase           =	TFDeiTForImageClassificationWithTeacher.from_pretrained("facebook/deit-base-distilled-patch16-224"      )

											__lowerCAmelCase           =	self.default_image_processor
											__lowerCAmelCase           =	prepare_img()
											__lowerCAmelCase           =	image_processor(images=_A		,      return_tensors="tf"      )

											# forward pass
											__lowerCAmelCase           =	model(**_A      )

											# verify the logits
											__lowerCAmelCase           =	tf.TensorShape((1, 1_0_0_0)      )
											self.assertEqual(outputs.logits.shape		,      _A      )

											__lowerCAmelCase           =	tf.constant([-1.02_66, 0.19_12, -1.28_61]      )

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




