






from sklearn.metrics import recall_score

import datasets


__UpperCamelCase      :      Optional[Any]     						=						"""
Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:
Recall = TP / (TP + FN)
Where TP is the true positives and FN is the false negatives.
"""


__UpperCamelCase      :      Any     						=						"""
Args:
- **predictions** (`list` of `int`): The predicted labels.
- **references** (`list` of `int`): The ground truth labels.
- **labels** (`list` of `int`): The set of labels to include when `average` is not set to `binary`, and their order when average is `None`. Labels present in the data can be excluded in this input, for example to calculate a multiclass average ignoring a majority negative class, while labels not present in the data will result in 0 components in a macro average. For multilabel targets, labels are column indices. By default, all labels in y_true and y_pred are used in sorted order. Defaults to None.
- **pos_label** (`int`): The class label to use as the 'positive class' when calculating the recall. Defaults to `1`.
- **average** (`string`): This parameter is required for multiclass/multilabel targets. If None, the scores for each class are returned. Otherwise, this determines the type of averaging performed on the data. Defaults to `'binary'`.
    - `'binary'`: Only report results for the class specified by `pos_label`. This is applicable only if the target labels and predictions are binary.
    - `'micro'`: Calculate metrics globally by counting the total true positives, false negatives, and false positives.
    - `'macro'`: Calculate metrics for each label, and find their unweighted mean. This does not take label imbalance into account.
    - `'weighted'`: Calculate metrics for each label, and find their average weighted by support (the number of true instances for each label). This alters `'macro'` to account for label imbalance. Note that it can result in an F-score that is not between precision and recall.
    - `'samples'`: Calculate metrics for each instance, and find their average (only meaningful for multilabel classification).
- **sample_weight** (`list` of `float`): Sample weights Defaults to `None`.
- **zero_division** (): Sets the value to return when there is a zero division. Defaults to .
    - `'warn'`: If there is a zero division, the return value is `0`, but warnings are also raised.
    - `0`: If there is a zero division, the return value is `0`.
    - `1`: If there is a zero division, the return value is `1`.

Returns:
- **recall** (`float`, or `array` of `float`): Either the general recall score, or the recall scores for individual classes, depending on the values input to `labels` and `average`. Minimum possible value is 0. Maximum possible value is 1. A higher recall means that more of the positive examples have been labeled correctly. Therefore, a higher recall is generally considered better.

Examples:

    Example 1-A simple example with some errors
        >>> recall_metric = datasets.load_metric('recall')
        >>> results = recall_metric.compute(references=[0, 0, 1, 1, 1], predictions=[0, 1, 0, 1, 1])
        >>> print(results)
        {'recall': 0.6666666666666666}

    Example 2-The same example as Example 1, but with `pos_label=0` instead of the default `pos_label=1`.
        >>> recall_metric = datasets.load_metric('recall')
        >>> results = recall_metric.compute(references=[0, 0, 1, 1, 1], predictions=[0, 1, 0, 1, 1], pos_label=0)
        >>> print(results)
        {'recall': 0.5}

    Example 3-The same example as Example 1, but with `sample_weight` included.
        >>> recall_metric = datasets.load_metric('recall')
        >>> sample_weight = [0.9, 0.2, 0.9, 0.3, 0.8]
        >>> results = recall_metric.compute(references=[0, 0, 1, 1, 1], predictions=[0, 1, 0, 1, 1], sample_weight=sample_weight)
        >>> print(results)
        {'recall': 0.55}

    Example 4-A multiclass example, using different averages.
        >>> recall_metric = datasets.load_metric('recall')
        >>> predictions = [0, 2, 1, 0, 0, 1]
        >>> references = [0, 1, 2, 0, 1, 2]
        >>> results = recall_metric.compute(predictions=predictions, references=references, average='macro')
        >>> print(results)
        {'recall': 0.3333333333333333}
        >>> results = recall_metric.compute(predictions=predictions, references=references, average='micro')
        >>> print(results)
        {'recall': 0.3333333333333333}
        >>> results = recall_metric.compute(predictions=predictions, references=references, average='weighted')
        >>> print(results)
        {'recall': 0.3333333333333333}
        >>> results = recall_metric.compute(predictions=predictions, references=references, average=None)
        >>> print(results)
        {'recall': array([1., 0., 0.])}
"""


__UpperCamelCase      :      Any     						=						"""
@article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P. and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.}, journal={Journal of Machine Learning Research}, volume={12}, pages={2825--2830}, year={2011}
"""


@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION   ,			_KWARGS_DESCRIPTION   )
class        __UpperCamelCase    (     datasets.Metric   ):







	def  _a   (  self      :							Dict			)		-> List[str]:
		"""simple docstring"""







		return datasets.MetricInfo(
		    description=_DESCRIPTION       ,				citation=_CITATION       ,				inputs_description=_KWARGS_DESCRIPTION       ,				features=datasets.Features(
		        {
		            """predictions""": datasets.Sequence(datasets.Value("""int32"""			)			),
		            """references""": datasets.Sequence(datasets.Value("""int32"""			)			),
		        }
		        if self.config_name == """multilabel"""
		        else {
		            """predictions""": datasets.Value("""int32"""			),
		            """references""": datasets.Value("""int32"""			),
		        }			)       ,				reference_urls=["""https://scikit-learn.org/stable/modules/generated/sklearn.metrics.recall_score.html"""]       ,				)







	def  _a   (  self      :							Tuple       ,				_lowerCAmelCase      :							Optional[int]       ,				_lowerCAmelCase      :							List[Any]       ,				_lowerCAmelCase      :							List[str]=None       ,				_lowerCAmelCase      :							str=1       ,				_lowerCAmelCase      :							Optional[int]="binary"       ,				_lowerCAmelCase      :							Optional[int]=None       ,				_lowerCAmelCase      :							Union[str, Any]="warn"       ,				)		-> Optional[Any]:
		"""simple docstring"""







		__lowercase             =  recall_score(
		    _lowerCAmelCase       ,				_lowerCAmelCase       ,				labels=_lowerCAmelCase       ,				pos_label=_lowerCAmelCase       ,				average=_lowerCAmelCase       ,				sample_weight=_lowerCAmelCase       ,				zero_division=_lowerCAmelCase       ,				)
		return {"recall": float(_lowerCAmelCase			) if score.size == 1 else score}









import inspect
import unittest
from typing import List

import numpy as np

from transformers import EfficientFormerConfig
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 (
						    TFEfficientFormerForImageClassification,
						    TFEfficientFormerForImageClassificationWithTeacher,
						    TFEfficientFormerModel,
						)
						from transformers.models.efficientformer.modeling_tf_efficientformer import (
						    TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
						)


if is_vision_available():
						from PIL import Image

						from transformers import EfficientFormerImageProcessor


class        __UpperCamelCase    :







	def __init__(  self      :							int       ,				_lowerCAmelCase      :							Tuple       ,				_lowerCAmelCase      :							int = 13       ,				_lowerCAmelCase      :							int = 64       ,				_lowerCAmelCase      :							int = 2       ,				_lowerCAmelCase      :							int = 3       ,				_lowerCAmelCase      :							int = 3       ,				_lowerCAmelCase      :							bool = True       ,				_lowerCAmelCase      :							bool = True       ,				_lowerCAmelCase      :							int = 128       ,				_lowerCAmelCase      :							Optional[int]=[16, 32, 64, 128]       ,				_lowerCAmelCase      :							int = 7       ,				_lowerCAmelCase      :							int = 4       ,				_lowerCAmelCase      :							int = 37       ,				_lowerCAmelCase      :							str = "gelu"       ,				_lowerCAmelCase      :							float = 0.1       ,				_lowerCAmelCase      :							float = 0.1       ,				_lowerCAmelCase      :							int = 10       ,				_lowerCAmelCase      :							float = 0.02       ,				_lowerCAmelCase      :							int = 2       ,				_lowerCAmelCase      :							int = 1       ,				_lowerCAmelCase      :							int = 128       ,				_lowerCAmelCase      :							List[int] = [2, 2, 2, 2]       ,				_lowerCAmelCase      :							int = 2       ,				_lowerCAmelCase      :							int = 2       ,				)		-> Tuple:
		"""simple docstring"""







		__lowercase             =  parent
		__lowercase             =  batch_size
		__lowercase             =  image_size
		__lowercase             =  patch_size
		__lowercase             =  num_channels
		__lowercase             =  is_training
		__lowercase             =  use_labels
		__lowercase             =  hidden_size
		__lowercase             =  num_hidden_layers
		__lowercase             =  num_attention_heads
		__lowercase             =  intermediate_size
		__lowercase             =  hidden_act
		__lowercase             =  hidden_dropout_prob
		__lowercase             =  attention_probs_dropout_prob
		__lowercase             =  type_sequence_label_size
		__lowercase             =  initializer_range
		__lowercase             =  encoder_stride
		__lowercase             =  num_attention_outputs
		__lowercase             =  embed_dim
		__lowercase             =  embed_dim + 1
		__lowercase             =  resolution
		__lowercase             =  depths
		__lowercase             =  hidden_sizes
		__lowercase             =  dim
		__lowercase             =  mlp_expansion_ratio







	def  _a   (  self      :							List[Any]			)		-> Optional[int]:
		"""simple docstring"""







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

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

		__lowercase             =  self.get_config()

		return config, pixel_values, labels







	def  _a   (  self      :							Optional[Any]			)		-> str:
		"""simple docstring"""







		return EfficientFormerConfig(
		    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=_lowerCAmelCase       ,				initializer_range=self.initializer_range       ,				encoder_stride=self.encoder_stride       ,				resolution=self.resolution       ,				depths=self.depths       ,				hidden_sizes=self.hidden_sizes       ,				dim=self.dim       ,				mlp_expansion_ratio=self.mlp_expansion_ratio       ,				)







	def  _a   (  self      :							Union[str, Any]       ,				_lowerCAmelCase      :							Dict       ,				_lowerCAmelCase      :							List[str]       ,				_lowerCAmelCase      :							Optional[int]			)		-> Optional[int]:
		"""simple docstring"""







		__lowercase             =  TFEfficientFormerModel(config=_lowerCAmelCase			)
		__lowercase             =  model(_lowerCAmelCase       ,				training=_lowerCAmelCase			)
		self.parent.assertEqual(result.last_hidden_state.shape       ,				(self.batch_size, self.seq_length, self.hidden_size)			)







	def  _a   (  self      :							Union[str, Any]       ,				_lowerCAmelCase      :							Dict       ,				_lowerCAmelCase      :							Dict       ,				_lowerCAmelCase      :							Dict			)		-> Optional[Any]:
		"""simple docstring"""







		__lowercase             =  self.type_sequence_label_size
		__lowercase             =  TFEfficientFormerForImageClassification(_lowerCAmelCase			)
		__lowercase             =  model(_lowerCAmelCase       ,				labels=_lowerCAmelCase       ,				training=_lowerCAmelCase			)
		self.parent.assertEqual(result.logits.shape       ,				(self.batch_size, self.type_sequence_label_size)			)

		# test greyscale images
		__lowercase             =  1
		__lowercase             =  TFEfficientFormerForImageClassification(_lowerCAmelCase			)

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







	def  _a   (  self      :							Optional[Any]			)		-> Any:
		"""simple docstring"""







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


@require_tf
class        __UpperCamelCase    (     _lowerCAmelCase   ,			_lowerCAmelCase   ,			unittest.TestCase   ):
	__snake_case	:Any   =       (
	    (
	        TFEfficientFormerModel,
	        TFEfficientFormerForImageClassificationWithTeacher,
	        TFEfficientFormerForImageClassification,
	    )
	    if is_tf_available()
	    else ()
	)
	__snake_case	:Any   =       (
	    {
	        'feature-extraction': TFEfficientFormerModel,
	        'image-classification': (
	            TFEfficientFormerForImageClassification,
	            TFEfficientFormerForImageClassificationWithTeacher,
	        ),
	    }
	    if is_tf_available()
	    else {}
	)

	__snake_case	:int   =       False

	__snake_case	:Optional[int]   =       False
	__snake_case	:int   =       False
	__snake_case	:Any   =       False
	__snake_case	:Any   =       False







	def  _a   (  self      :							Tuple			)		-> Tuple:
		"""simple docstring"""







		__lowercase             =  TFEfficientFormerModelTester(self			)
		__lowercase             =  ConfigTester(
		    self       ,				config_class=_lowerCAmelCase       ,				has_text_modality=_lowerCAmelCase       ,				hidden_size=37			)







	def  _a   (  self      :							Optional[int]			)		-> int:
		"""simple docstring"""







		self.config_tester.run_common_tests()







	@unittest.skip(reason="""EfficientFormer does not use inputs_embeds"""			)
	def  _a   (  self      :							Optional[int]			)		-> Any:
		"""simple docstring"""







		pass







	@unittest.skip(reason="""EfficientFormer does not support input and output embeddings"""			)
	def  _a   (  self      :							int			)		-> str:
		"""simple docstring"""







		pass







	def  _a   (  self      :							Union[str, Any]			)		-> List[str]:
		"""simple docstring"""







		__lowercase       ,						__lowercase             =  self.model_tester.prepare_config_and_inputs_for_common()

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

			__lowercase             =  ["""pixel_values"""]
			self.assertListEqual(arg_names[:1]       ,				_lowerCAmelCase			)







	def  _a   (  self      :							Union[str, Any]			)		-> Dict:
		"""simple docstring"""







		def check_hidden_states_output(_lowerCAmelCase      :							int       ,				_lowerCAmelCase      :							Any       ,				_lowerCAmelCase      :							List[Any]			):
			__lowercase             =  model_class(_lowerCAmelCase			)

			__lowercase             =  model(**self._prepare_for_class(_lowerCAmelCase       ,				_lowerCAmelCase			)       ,				training=_lowerCAmelCase			)
			__lowercase             =  outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

			__lowercase             =  getattr(
			    self.model_tester       ,				"""expected_num_hidden_layers"""       ,				self.model_tester.num_hidden_layers + 1			)
			self.assertEqual(len(_lowerCAmelCase			)       ,				_lowerCAmelCase			)

			if hasattr(self.model_tester       ,				"""encoder_seq_length"""			):
				__lowercase             =  self.model_tester.encoder_seq_length
				if hasattr(self.model_tester       ,				"""chunk_length"""			) and self.model_tester.chunk_length > 1:
					__lowercase             =  seq_length * self.model_tester.chunk_length
			else:
				__lowercase             =  self.model_tester.seq_length

			self.assertListEqual(
			    list(hidden_states[-1].shape[-2:]			)       ,				[seq_length, self.model_tester.hidden_size]       ,				)

			if config.is_encoder_decoder:
				__lowercase             =  outputs.decoder_hidden_states

				self.asseretIsInstance(_lowerCAmelCase       ,				(list, tuple)			)
				self.assertEqual(len(_lowerCAmelCase			)       ,				_lowerCAmelCase			)
				__lowercase             =  getattr(self.model_tester       ,				"""seq_length"""       ,				_lowerCAmelCase			)
				__lowercase             =  getattr(self.model_tester       ,				"""decoder_seq_length"""       ,				_lowerCAmelCase			)

				self.assertListEqual(
				    list(hidden_states[-1].shape[-2:]			)       ,				[decoder_seq_length, self.model_tester.hidden_size]       ,				)

		__lowercase       ,						__lowercase             =  self.model_tester.prepare_config_and_inputs_for_common()

		for model_class in self.all_model_classes:
			__lowercase             =  True
			check_hidden_states_output(_lowerCAmelCase       ,				_lowerCAmelCase       ,				_lowerCAmelCase			)

			# check that output_hidden_states also work using config
			del inputs_dict["output_hidden_states"]
			__lowercase             =  True

			check_hidden_states_output(_lowerCAmelCase       ,				_lowerCAmelCase       ,				_lowerCAmelCase			)







	def  _a   (  self      :							Optional[Any]       ,				_lowerCAmelCase      :							Any       ,				_lowerCAmelCase      :							str       ,				_lowerCAmelCase      :							Optional[Any]=False			)		-> Dict:
		"""simple docstring"""







		__lowercase             =  super()._prepare_for_class(_lowerCAmelCase       ,				_lowerCAmelCase       ,				return_labels=_lowerCAmelCase			)

		if return_labels:
			if model_class.__name__ == "TFEfficientFormerForImageClassificationWithTeacher":
				del inputs_dict["labels"]

		return inputs_dict







	def  _a   (  self      :							int			)		-> int:
		"""simple docstring"""







		__lowercase             =  self.model_tester.prepare_config_and_inputs()
		self.model_tester.create_and_check_model(*_lowerCAmelCase			)







	@unittest.skip(reason="""EfficientFormer does not implement masked image modeling yet"""			)
	def  _a   (  self      :							Union[str, Any]			)		-> str:
		"""simple docstring"""







		__lowercase             =  self.model_tester.prepare_config_and_inputs()
		self.model_tester.create_and_check_for_masked_image_modeling(*_lowerCAmelCase			)







	def  _a   (  self      :							Optional[int]			)		-> Union[str, Any]:
		"""simple docstring"""







		__lowercase             =  self.model_tester.prepare_config_and_inputs()
		self.model_tester.create_and_check_for_image_classification(*_lowerCAmelCase			)







	@slow
	def  _a   (  self      :							List[str]			)		-> List[Any]:
		"""simple docstring"""







		for model_name in TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
			__lowercase             =  TFEfficientFormerModel.from_pretrained(_lowerCAmelCase			)
			self.assertIsNotNone(_lowerCAmelCase			)







	def  _a   (  self      :							Any			)		-> List[str]:
		"""simple docstring"""







		__lowercase       ,						__lowercase             =  self.model_tester.prepare_config_and_inputs_for_common()
		__lowercase             =  True

		__lowercase             =  getattr(self.model_tester       ,				"""seq_length"""       ,				_lowerCAmelCase			)
		__lowercase             =  getattr(self.model_tester       ,				"""encoder_seq_length"""       ,				_lowerCAmelCase			)
		__lowercase             =  getattr(self.model_tester       ,				"""key_length"""       ,				_lowerCAmelCase			)
		__lowercase             =  getattr(self.model_tester       ,				"""chunk_length"""       ,				_lowerCAmelCase			)

		if chunk_length is not None and hasattr(self.model_tester       ,				"""num_hashes"""			):
			__lowercase             =  encoder_seq_length * self.model_tester.num_hashes

		for model_class in self.all_model_classes:
			__lowercase             =  True
			__lowercase             =  False
			__lowercase             =  True
			__lowercase             =  model_class(_lowerCAmelCase			)

			__lowercase             =  model(**self._prepare_for_class(_lowerCAmelCase       ,				_lowerCAmelCase			)       ,				training=_lowerCAmelCase			)
			__lowercase             =  outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
			self.assertEqual(len(_lowerCAmelCase			)       ,				self.model_tester.num_attention_outputs			)

			# check that output_attentions also work using config
			del inputs_dict["output_attentions"]
			__lowercase             =  True
			__lowercase             =  model_class(_lowerCAmelCase			)
			__lowercase             =  model(**self._prepare_for_class(_lowerCAmelCase       ,				_lowerCAmelCase			)       ,				training=_lowerCAmelCase			)

			__lowercase             =  outputs.encoder_attentions if config.is_encoder_decoder else outputs.attentions
			self.assertEqual(len(_lowerCAmelCase			)       ,				self.model_tester.num_attention_outputs			)

			if chunk_length is not None:
				self.assertListEqual(
				    list(attentions[0].shape[-4:]			)       ,				[self.model_tester.num_attention_heads, encoder_seq_length, chunk_length, encoder_key_length]       ,				)
			else:
				self.assertListEqual(
				    list(attentions[0].shape[-3:]			)       ,				[self.model_tester.num_attention_heads, encoder_seq_length, encoder_key_length]       ,				)







	def  _a   (  self      :							Dict			)		-> Optional[int]:
		"""simple docstring"""







		__lowercase       ,						__lowercase             =  self.model_tester.prepare_config_and_inputs_for_common()

		for model_class in self.all_model_classes:
			# Prepare our model
			__lowercase             =  model_class(_lowerCAmelCase			)
			# These are maximally general inputs for the model, with multiple None dimensions
			# Hopefully this will catch any conditionals that fail for flexible shapes
			__lowercase             =  {
			    key: tf.keras.Input(shape=val.shape[1:]       ,				dtype=val.dtype       ,				name=_lowerCAmelCase			)
			    for key, val in model.input_signature.items()
			    if key in model.dummy_inputs
			}
			__lowercase             =  model(_lowerCAmelCase			)
			self.assertTrue(outputs_dict is not None			)





def 				snake_case  (     ):




	'''simple docstring'''







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




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







	@cached_property
	def  _a   (  self      :							Optional[Any]			)		-> Any:
		"""simple docstring"""







		return (
		    EfficientFormerImageProcessor.from_pretrained("""snap-research/efficientformer-l1-300"""			)
		    if is_vision_available()
		    else None
		)







	@slow
	def  _a   (  self      :							Optional[Any]			)		-> Any:
		"""simple docstring"""







		__lowercase             =  TFEfficientFormerForImageClassification.from_pretrained("""snap-research/efficientformer-l1-300"""			)
		__lowercase             =  self.default_image_processor
		__lowercase             =  prepare_img()
		__lowercase             =  image_processor(images=_lowerCAmelCase       ,				return_tensors="""tf"""			)
		# forward pass
		__lowercase             =  model(**_lowerCAmelCase       ,				training=_lowerCAmelCase			)
		# verify the logits
		__lowercase             =  tf.TensorShape((1, 1000)			)
		self.assertEqual(outputs.logits.shape       ,				_lowerCAmelCase			)
		__lowercase             =  tf.constant([-0.0_555, 0.4_825, -0.0_852]			)
		self.assertTrue(np.allclose(outputs.logits[0, :3]       ,				_lowerCAmelCase       ,				atol=1e-4			)			)







	@slow
	def  _a   (  self      :							Optional[Any]			)		-> Tuple:
		"""simple docstring"""







		__lowercase             =  TFEfficientFormerForImageClassificationWithTeacher.from_pretrained(
		    """snap-research/efficientformer-l1-300"""			)
		__lowercase             =  self.default_image_processor
		__lowercase             =  prepare_img()
		__lowercase             =  image_processor(images=_lowerCAmelCase       ,				return_tensors="""tf"""			)
		# forward pass
		__lowercase             =  model(**_lowerCAmelCase       ,				training=_lowerCAmelCase			)
		# verify the logits
		__lowercase             =  tf.TensorShape((1, 1000)			)
		self.assertEqual(outputs.logits.shape       ,				_lowerCAmelCase			)
		__lowercase             =  tf.constant([-0.1_312, 0.4_353, -1.0_499]			)
		self.assertTrue(np.allclose(outputs.logits[0, :3]       ,				_lowerCAmelCase       ,				atol=1e-4			)			)

