




import inspect
import unittest

from huggingface_hub import hf_hub_download

from transformers import ASTConfig
from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_torchaudio_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch
							from torch import nn

							from transformers import ASTForAudioClassification, ASTModel
							from transformers.models.audio_spectrogram_transformer.modeling_audio_spectrogram_transformer import (
							    AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
							)


if is_torchaudio_available():
							import torchaudio

							from transformers import ASTFeatureExtractor




class 		__A   :

						def __init__(		self :Optional[Any]     ,			__snake_case :Any     ,			__snake_case :List[Any]=13     ,			__snake_case :str=2     ,			__snake_case :Dict=24     ,			__snake_case :Tuple=16     ,			__snake_case :Union[str, Any]=True     ,			__snake_case :List[str]=True     ,			__snake_case :str=32     ,			__snake_case :List[Any]=5     ,			__snake_case :Optional[Any]=4     ,			__snake_case :str=37     ,			__snake_case :Union[str, Any]="gelu"     ,			__snake_case :Optional[int]=0.1     ,			__snake_case :Dict=0.1     ,			__snake_case :Dict=10     ,			__snake_case :Union[str, Any]=0.02     ,			__snake_case :Union[str, Any]=None     ,			__snake_case :Optional[Any]=2     ,			__snake_case :Tuple=2     ,			):
										'''simple docstring'''

										__magic_name__						:						Tuple										=parent
										__magic_name__						:						Optional[Any]										=batch_size
										__magic_name__						:						Optional[Any]										=patch_size
										__magic_name__						:						Dict										=max_length
										__magic_name__						:						Optional[Any]										=num_mel_bins
										__magic_name__						:						Tuple										=is_training
										__magic_name__						:						Dict										=use_labels
										__magic_name__						:						Optional[int]										=hidden_size
										__magic_name__						:						Optional[Any]										=num_hidden_layers
										__magic_name__						:						Dict										=num_attention_heads
										__magic_name__						:						Dict										=intermediate_size
										__magic_name__						:						Union[str, Any]										=hidden_act
										__magic_name__						:						List[str]										=hidden_dropout_prob
										__magic_name__						:						Optional[int]										=attention_probs_dropout_prob
										__magic_name__						:						Optional[Any]										=type_sequence_label_size
										__magic_name__						:						int										=initializer_range
										__magic_name__						:						Union[str, Any]										=scope
										__magic_name__						:						Optional[Any]										=frequency_stride
										__magic_name__						:						int										=time_stride

										# in AST, the seq length equals the number of patches + 2 (we add 2 for the [CLS] and distillation tokens)
										__magic_name__						:						int										=(self.num_mel_bins - self.patch_size) // self.frequency_stride + 1
										__magic_name__						:						List[Any]										=(self.max_length - self.patch_size) // self.time_stride + 1
										__magic_name__						:						Optional[Any]										=frequency_out_dimension * time_out_dimension
										__magic_name__						:						Dict										=num_patches + 2

						def      A__    (		self :List[str]			):
										'''simple docstring'''

										__magic_name__						:						List[Any]										=floats_tensor([self.batch_size, self.max_length, self.num_mel_bins]			)

										__magic_name__						:						Optional[int]										=None
										if self.use_labels:
														__magic_name__						:						Union[str, Any]										=ids_tensor([self.batch_size]     ,			self.type_sequence_label_size			)

										__magic_name__						:						str										=self.get_config()

										return config, input_values, labels

						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										return ASTConfig(
										    patch_size=self.patch_size     ,			max_length=self.max_length     ,			num_mel_bins=self.num_mel_bins     ,			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=__snake_case     ,			initializer_range=self.initializer_range     ,			frequency_stride=self.frequency_stride     ,			time_stride=self.time_stride     ,			)

						def      A__    (		self :Tuple     ,			__snake_case :Optional[int]     ,			__snake_case :List[str]     ,			__snake_case :Optional[int]			):
										'''simple docstring'''

										__magic_name__						:						List[Any]										=ASTModel(config=__snake_case			)
										model.to(__snake_case			)
										model.eval()
										__magic_name__						:						Any										=model(__snake_case			)
										self.parent.assertEqual(result.last_hidden_state.shape     ,			(self.batch_size, self.seq_length, self.hidden_size)			)


						def      A__    (		self :Dict			):
										'''simple docstring'''

										__magic_name__						:						Any										=self.prepare_config_and_inputs()
										(
										    (
										    __magic_name__       
										)					,			(
										    __magic_name__       
										)					,			(
										    __magic_name__       
										)					,			       
										)						:						Union[str, Any]										=config_and_inputs
										__magic_name__						:						List[str]										={"""input_values""": input_values}
										return config, inputs_dict




@require_torch
class 		__A   (      __UpperCamelCase       ,    __UpperCamelCase       ,    unittest.TestCase      ):
						UpperCamelCase      =       (
						    (
						        ASTModel,
						        ASTForAudioClassification,
						    )
						    if is_torch_available()
						    else ()
						)
						UpperCamelCase      =       (
						    {'audio-classification': ASTForAudioClassification, 'feature-extraction': ASTModel}
						    if is_torch_available()
						    else {}
						)
						UpperCamelCase      =       False
						UpperCamelCase      =       False
						UpperCamelCase      =       False
						UpperCamelCase      =       False

						def      A__    (		self :int     ,			__snake_case :Dict     ,			__snake_case :List[str]     ,			__snake_case :Tuple     ,			__snake_case :int     ,			__snake_case :str			):
										'''simple docstring'''

										if pipeline_test_casse_name == "AudioClassificationPipelineTests":
														return True

										return False

						def      A__    (		self :Tuple			):
										'''simple docstring'''

										__magic_name__						:						Optional[Any]										=ASTModelTester(self			)
										__magic_name__						:						Tuple										=ConfigTester(self     ,			config_class=__snake_case     ,			has_text_modality=__snake_case     ,			hidden_size=37			)

						def      A__    (		self :Optional[Any]			):
										'''simple docstring'''

										self.config_tester.run_common_tests()

						@unittest.skip(reason="""AST does not use inputs_embeds"""			)
						def      A__    (		self :Dict			):
										'''simple docstring'''

										pass

						def      A__    (		self :List[str]			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						Any										=self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														__magic_name__						:						str										=model_class(__snake_case			)
														self.assertIsInstance(model.get_input_embeddings()     ,			(nn.Module)			)
														__magic_name__						:						str										=model.get_output_embeddings()
														self.assertTrue(x is None or isinstance(__snake_case     ,			nn.Linear			)			)

						def      A__    (		self :Tuple			):
										'''simple docstring'''

										__magic_name__					,			__magic_name__						:						str										=self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														__magic_name__						:						Any										=model_class(__snake_case			)
														__magic_name__						:						int										=inspect.signature(model.forward			)
														# signature.parameters is an OrderedDict => so arg_names order is deterministic
														__magic_name__						:						List[Any]										=[*signature.parameters.keys()]

														__magic_name__						:						str										=["""input_values"""]
														self.assertListEqual(arg_names[:1]     ,			__snake_case			)

						def      A__    (		self :Optional[int]			):
										'''simple docstring'''

										__magic_name__						:						Optional[int]										=self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_model(*__snake_case			)


						@slow
						def      A__    (		self :Optional[int]			):
										'''simple docstring'''

										for model_name in AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														__magic_name__						:						Any										=ASTModel.from_pretrained(__snake_case			)
														self.assertIsNotNone(__snake_case			)




def 		lowerCAmelCase_ (						):
				__magic_name__						:						Optional[Any]										=hf_hub_download(
				    repo_id="""nielsr/audio-spectogram-transformer-checkpoint"""						,  filename="""sample_audio.flac"""						,  repo_type="""dataset""" )

				__magic_name__					,			__magic_name__						:						Union[str, Any]										=torchaudio.load(__lowerCAmelCase )

				return audio, sampling_rate




@require_torch
@require_torchaudio
class 		__A   (      unittest.TestCase      ):

						@cached_property
						def      A__    (		self :Tuple			):
										'''simple docstring'''

										return (
										    ASTFeatureExtractor.from_pretrained("""MIT/ast-finetuned-audioset-10-10-0.4593"""			)
										    if is_torchaudio_available()
										    else None
										)


						@slow
						def      A__    (		self :Union[str, Any]			):
										'''simple docstring'''

										__magic_name__						:						List[Any]										=self.default_feature_extractor
										__magic_name__						:						Tuple										=ASTForAudioClassification.from_pretrained("""MIT/ast-finetuned-audioset-10-10-0.4593"""			).to(__snake_case			)

										__magic_name__						:						str										=self.default_feature_extractor
										__magic_name__					,			__magic_name__						:						str										=prepare_audio()
										__magic_name__						:						Optional[Any]										=audio.squeeze().numpy()
										__magic_name__						:						Optional[Any]										=feature_extractor(__snake_case     ,			sampling_rate=__snake_case     ,			return_tensors="""pt"""			).to(__snake_case			)

										# forward pass
										with torch.no_grad():
														__magic_name__						:						Dict										=model(**__snake_case			)

										# verify the logits
										__magic_name__						:						str										=torch.Size((1, 5_27)			)
										self.assertEqual(outputs.logits.shape     ,			__snake_case			)

										__magic_name__						:						Any										=torch.tensor([-0.8760, -7.0042, -8.6602]			).to(__snake_case			)

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






import json
import pathlib
import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision, slow
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
     import torch

if is_vision_available():
     from PIL import Image

     from transformers import DetaImageProcessor




class        _SCREAMING_SNAKE_CASE	(   unittest.TestCase			):
      def __init__(      self		,						lowerCamelCase		,						lowerCamelCase=7		,						lowerCamelCase=3		,						lowerCamelCase=30		,						lowerCamelCase=4_00		,						lowerCamelCase=True		,						lowerCamelCase=None		,						lowerCamelCase=True		,						lowerCamelCase=[0.5, 0.5, 0.5]		,						lowerCamelCase=[0.5, 0.5, 0.5]		,						lowerCamelCase=True		,						lowerCamelCase=1 / 2_55		,						lowerCamelCase=True		,						):
          # by setting size["longest_edge"] > max_resolution we're effectively not testing this :p
          snake_case__    =					size if size is not None else {"shortest_edge": 18, "longest_edge": 13_33}
          snake_case__    =					parent
          snake_case__    =					batch_size
          snake_case__    =					num_channels
          snake_case__    =					min_resolution
          snake_case__    =					max_resolution
          snake_case__    =					do_resize
          snake_case__    =					size
          snake_case__    =					do_normalize
          snake_case__    =					image_mean
          snake_case__    =					image_std
          snake_case__    =					do_rescale
          snake_case__    =					rescale_factor
          snake_case__    =					do_pad
      def A_      (      self			):
          return {
              "do_resize": self.do_resize,
              "size": self.size,
              "do_normalize": self.do_normalize,
              "image_mean": self.image_mean,
              "image_std": self.image_std,
              "do_rescale": self.do_rescale,
              "rescale_factor": self.rescale_factor,
              "do_pad": self.do_pad,
          }



      def A_      (      self		,						lowerCamelCase		,						lowerCamelCase=False			):
          if not batched:
              snake_case__    =					image_inputs[0]
              if isinstance(lowerCamelCase		,						Image.Image			):
                  snake_case__    ,       snake_case__    =					image.size
              else:
                  snake_case__    ,       snake_case__    =					image.shape[1], image.shape[2]
              if w < h:
                  snake_case__    =					int(self.size["shortest_edge"] * h / w			)
                  snake_case__    =					self.size["shortest_edge"]
              elif w > h:
                  snake_case__    =					self.size["shortest_edge"]
                  snake_case__    =					int(self.size["shortest_edge"] * w / h			)
              else:
                  snake_case__    =					self.size["shortest_edge"]
                  snake_case__    =					self.size["shortest_edge"]

          else:
              snake_case__    =					[]
              for image in image_inputs:
                  snake_case__    ,       snake_case__    =					self.get_expected_values([image]			)
                  expected_values.append((expected_height, expected_width)			)
              snake_case__    =					max(lowerCamelCase		,						key=lambda lowerCamelCase			: item[0]			)[0]
              snake_case__    =					max(lowerCamelCase		,						key=lambda lowerCamelCase			: item[1]			)[1]

          return expected_height, expected_width





@require_torch
@require_vision
class        _SCREAMING_SNAKE_CASE	(   __UpperCamelCase							,       unittest.TestCase			):
      _A    :		List[str]     						=  DetaImageProcessor if is_vision_available() else None
      def A_      (      self			):
          snake_case__    =					DetaImageProcessingTester(self			)
      @property
      def A_      (      self			):
          return self.image_processor_tester.prepare_image_processor_dict()
      def A_      (      self			):
          snake_case__    =					self.image_processing_class(**self.image_processor_dict			)
          self.assertTrue(hasattr(lowerCamelCase		,						"image_mean"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"image_std"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"do_normalize"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"do_resize"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"do_rescale"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"do_pad"			)			)
          self.assertTrue(hasattr(lowerCamelCase		,						"size"			)			)
      def A_      (      self			):
          snake_case__    =					self.image_processing_class.from_dict(self.image_processor_dict			)
          self.assertEqual(image_processor.size		,						{"shortest_edge": 18, "longest_edge": 13_33}			)
          self.assertEqual(image_processor.do_pad		,						lowerCamelCase			)
      def A_      (      self			):
          pass
      def A_      (      self			):
          # Initialize image_processing
          snake_case__    =					self.image_processing_class(**self.image_processor_dict			)
          # create random PIL images
          snake_case__    =					prepare_image_inputs(self.image_processor_tester		,						equal_resolution=lowerCamelCase			)
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase		,						Image.Image			)

          # Test not batched input
          snake_case__    =					image_processing(image_inputs[0]		,						return_tensors="pt"			).pixel_values

          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase			)

          self.assertEqual(
              encoded_images.shape		,						(1, self.image_processor_tester.num_channels, expected_height, expected_width)		,						)

          # Test batched
          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase		,						batched=lowerCamelCase			)

          snake_case__    =					image_processing(lowerCamelCase		,						return_tensors="pt"			).pixel_values
          self.assertEqual(
              encoded_images.shape		,						(
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  expected_height,
                  expected_width,
              )		,						)
      def A_      (      self			):
          # Initialize image_processing
          snake_case__    =					self.image_processing_class(**self.image_processor_dict			)
          # create random numpy tensors
          snake_case__    =					prepare_image_inputs(self.image_processor_tester		,						equal_resolution=lowerCamelCase		,						numpify=lowerCamelCase			)
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase		,						np.ndarray			)

          # Test not batched input
          snake_case__    =					image_processing(image_inputs[0]		,						return_tensors="pt"			).pixel_values

          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase			)

          self.assertEqual(
              encoded_images.shape		,						(1, self.image_processor_tester.num_channels, expected_height, expected_width)		,						)

          # Test batched
          snake_case__    =					image_processing(lowerCamelCase		,						return_tensors="pt"			).pixel_values

          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase		,						batched=lowerCamelCase			)

          self.assertEqual(
              encoded_images.shape		,						(
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  expected_height,
                  expected_width,
              )		,						)
      def A_      (      self			):
          # Initialize image_processing
          snake_case__    =					self.image_processing_class(**self.image_processor_dict			)
          # create random PyTorch tensors
          snake_case__    =					prepare_image_inputs(self.image_processor_tester		,						equal_resolution=lowerCamelCase		,						torchify=lowerCamelCase			)
          for image in image_inputs:
              self.assertIsInstance(lowerCamelCase		,						torch.Tensor			)

          # Test not batched input
          snake_case__    =					image_processing(image_inputs[0]		,						return_tensors="pt"			).pixel_values

          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase			)

          self.assertEqual(
              encoded_images.shape		,						(1, self.image_processor_tester.num_channels, expected_height, expected_width)		,						)

          # Test batched
          snake_case__    =					image_processing(lowerCamelCase		,						return_tensors="pt"			).pixel_values

          snake_case__    ,       snake_case__    =					self.image_processor_tester.get_expected_values(lowerCamelCase		,						batched=lowerCamelCase			)

          self.assertEqual(
              encoded_images.shape		,						(
                  self.image_processor_tester.batch_size,
                  self.image_processor_tester.num_channels,
                  expected_height,
                  expected_width,
              )		,						)
      @slow
      def A_      (      self			):
          # prepare image and target
          snake_case__    =					Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"			)
          with open("./tests/fixtures/tests_samples/COCO/coco_annotations.txt"		,						"r"			) as f:
              snake_case__    =					json.loads(f.read()			)

          snake_case__    =					{"image_id": 3_97_69, "annotations": target}

          # encode them
          snake_case__    =					DetaImageProcessor()
          snake_case__    =					image_processing(images=lowerCamelCase		,						annotations=lowerCamelCase		,						return_tensors="pt"			)

          # verify pixel values
          snake_case__    =					torch.Size([1, 3, 8_00, 10_66]			)
          self.assertEqual(encoding["pixel_values"].shape		,						lowerCamelCase			)

          snake_case__    =					torch.tensor([0.2_7_9_6, 0.3_1_3_8, 0.3_4_8_1]			)
          self.assertTrue(torch.allclose(encoding["pixel_values"][0, 0, 0, :3]		,						lowerCamelCase		,						atol=1e-4			)			)

          # verify area
          snake_case__    =					torch.tensor([5_8_8_7.9_6_0_0, 1_1_2_5_0.2_0_6_1, 4_8_9_3_5_3.8_4_3_8, 8_3_7_1_2_2.7_5_0_0, 1_4_7_9_6_7.5_1_5_6, 1_6_5_7_3_2.3_4_3_8]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["area"]		,						lowerCamelCase			)			)
          # verify boxes
          snake_case__    =					torch.Size([6, 4]			)
          self.assertEqual(encoding["labels"][0]["boxes"].shape		,						lowerCamelCase			)
          snake_case__    =					torch.tensor([0.5_5_0_3, 0.2_7_6_5, 0.0_6_0_4, 0.2_2_1_5]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["boxes"][0]		,						lowerCamelCase		,						atol=1e-3			)			)
          # verify image_id
          snake_case__    =					torch.tensor([3_97_69]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["image_id"]		,						lowerCamelCase			)			)
          # verify is_crowd
          snake_case__    =					torch.tensor([0, 0, 0, 0, 0, 0]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["iscrowd"]		,						lowerCamelCase			)			)
          # verify class_labels
          snake_case__    =					torch.tensor([75, 75, 63, 65, 17, 17]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["class_labels"]		,						lowerCamelCase			)			)
          # verify orig_size
          snake_case__    =					torch.tensor([4_80, 6_40]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["orig_size"]		,						lowerCamelCase			)			)
          # verify size
          snake_case__    =					torch.tensor([8_00, 10_66]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["size"]		,						lowerCamelCase			)			)



      @slow
      def A_      (      self			):
          # prepare image, target and masks_path
          snake_case__    =					Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"			)
          with open("./tests/fixtures/tests_samples/COCO/coco_panoptic_annotations.txt"		,						"r"			) as f:
              snake_case__    =					json.loads(f.read()			)

          snake_case__    =					{"file_name": "000000039769.png", "image_id": 3_97_69, "segments_info": target}

          snake_case__    =					pathlib.Path("./tests/fixtures/tests_samples/COCO/coco_panoptic"			)

          # encode them
          snake_case__    =					DetaImageProcessor(format="coco_panoptic"			)
          snake_case__    =					image_processing(images=lowerCamelCase		,						annotations=lowerCamelCase		,						masks_path=lowerCamelCase		,						return_tensors="pt"			)

          # verify pixel values
          snake_case__    =					torch.Size([1, 3, 8_00, 10_66]			)
          self.assertEqual(encoding["pixel_values"].shape		,						lowerCamelCase			)

          snake_case__    =					torch.tensor([0.2_7_9_6, 0.3_1_3_8, 0.3_4_8_1]			)
          self.assertTrue(torch.allclose(encoding["pixel_values"][0, 0, 0, :3]		,						lowerCamelCase		,						atol=1e-4			)			)

          # verify area
          snake_case__    =					torch.tensor([1_4_7_9_7_9.6_8_7_5, 1_6_5_5_2_7.0_4_6_9, 4_8_4_6_3_8.5_9_3_8, 1_1_2_9_2.9_3_7_5, 5_8_7_9.6_5_6_2, 7_6_3_4.1_1_4_7]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["area"]		,						lowerCamelCase			)			)
          # verify boxes
          snake_case__    =					torch.Size([6, 4]			)
          self.assertEqual(encoding["labels"][0]["boxes"].shape		,						lowerCamelCase			)
          snake_case__    =					torch.tensor([0.2_6_2_5, 0.5_4_3_7, 0.4_6_8_8, 0.8_6_2_5]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["boxes"][0]		,						lowerCamelCase		,						atol=1e-3			)			)
          # verify image_id
          snake_case__    =					torch.tensor([3_97_69]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["image_id"]		,						lowerCamelCase			)			)
          # verify is_crowd
          snake_case__    =					torch.tensor([0, 0, 0, 0, 0, 0]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["iscrowd"]		,						lowerCamelCase			)			)
          # verify class_labels
          snake_case__    =					torch.tensor([17, 17, 63, 75, 75, 93]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["class_labels"]		,						lowerCamelCase			)			)
          # verify masks
          snake_case__    =					82_28_73
          self.assertEqual(encoding["labels"][0]["masks"].sum().item()		,						lowerCamelCase			)
          # verify orig_size
          snake_case__    =					torch.tensor([4_80, 6_40]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["orig_size"]		,						lowerCamelCase			)			)
          # verify size
          snake_case__    =					torch.tensor([8_00, 10_66]			)
          self.assertTrue(torch.allclose(encoding["labels"][0]["size"]		,						lowerCamelCase			)			)



