

'''simple docstring'''




import shutil
import tempfile
import unittest
from unittest.mock import patch

from transformers import (
    DefaultFlowCallback,
    IntervalStrategy,
    PrinterCallback,
    ProgressCallback,
    Trainer,
    TrainerCallback,
    TrainingArguments,
    is_torch_available,
)
from transformers.testing_utils import require_torch


if is_torch_available():
						from transformers.trainer import DEFAULT_CALLBACKS

						from .test_trainer import RegressionDataset, RegressionModelConfig, RegressionPreTrainedModel






class   _SCREAMING_SNAKE_CASE   (   __a     ):



	def __init__(   self		:   str      ):
						__magic_name__						       =    []



	def 			snake_case__  (   self		:   Optional[int]			,				a__		:   Dict			,				a__		:   Optional[int]			,				a__		:   Optional[Any]			,				**a__		:   Tuple      ):
						self.events.append('''on_init_end'''      )



	def 			snake_case__  (   self		:   Tuple			,				a__		:   int			,				a__		:   Union[str, Any]			,				a__		:   List[str]			,				**a__		:   str      ):
						self.events.append('''on_train_begin'''      )



	def 			snake_case__  (   self		:   int			,				a__		:   List[Any]			,				a__		:   Tuple			,				a__		:   Dict			,				**a__		:   str      ):
						self.events.append('''on_train_end'''      )



	def 			snake_case__  (   self		:   Optional[int]			,				a__		:   List[str]			,				a__		:   Tuple			,				a__		:   List[Any]			,				**a__		:   List[str]      ):
						self.events.append('''on_epoch_begin'''      )



	def 			snake_case__  (   self		:   Union[str, Any]			,				a__		:   int			,				a__		:   Optional[Any]			,				a__		:   List[str]			,				**a__		:   Optional[int]      ):
						self.events.append('''on_epoch_end'''      )



	def 			snake_case__  (   self		:   List[Any]			,				a__		:   Tuple			,				a__		:   Any			,				a__		:   int			,				**a__		:   int      ):
						self.events.append('''on_step_begin'''      )



	def 			snake_case__  (   self		:   Any			,				a__		:   str			,				a__		:   Dict			,				a__		:   Union[str, Any]			,				**a__		:   Tuple      ):
						self.events.append('''on_step_end'''      )



	def 			snake_case__  (   self		:   List[Any]			,				a__		:   int			,				a__		:   List[Any]			,				a__		:   Tuple			,				**a__		:   Union[str, Any]      ):
						self.events.append('''on_evaluate'''      )



	def 			snake_case__  (   self		:   Union[str, Any]			,				a__		:   Union[str, Any]			,				a__		:   List[Any]			,				a__		:   Tuple			,				**a__		:   List[Any]      ):
						self.events.append('''on_predict'''      )



	def 			snake_case__  (   self		:   int			,				a__		:   Dict			,				a__		:   str			,				a__		:   str			,				**a__		:   Dict      ):
						self.events.append('''on_save'''      )



	def 			snake_case__  (   self		:   Optional[Any]			,				a__		:   Any			,				a__		:   int			,				a__		:   int			,				**a__		:   List[str]      ):
						self.events.append('''on_log'''      )



	def 			snake_case__  (   self		:   Union[str, Any]			,				a__		:   Optional[int]			,				a__		:   Optional[int]			,				a__		:   str			,				**a__		:   int      ):
						self.events.append('''on_prediction_step'''      )






@require_torch
class   _SCREAMING_SNAKE_CASE   (   unittest.TestCase     ):



	def 			snake_case__  (   self		:   Any      ):
						__magic_name__						       =    tempfile.mkdtemp()



	def 			snake_case__  (   self		:   Any      ):
						shutil.rmtree(self.output_dir      )



	def 			snake_case__  (   self		:   int			,				a__		:   Dict=0			,				a__		:   Any=0			,				a__		:   Any=64			,				a__		:   Optional[int]=64			,				a__		:   Union[str, Any]=None			,				a__		:   List[Any]=False			,				**a__		:   List[str]      ):
						# disable_tqdm in TrainingArguments has a flaky default since it depends on the level of logging. We make sure
						# its set to False since the tests later on depend on its value.
						__magic_name__						       =    RegressionDataset(length=a__      )
						__magic_name__						       =    RegressionDataset(length=a__      )
						__magic_name__						       =    RegressionModelConfig(a=a__			,				b=a__      )
						__magic_name__						       =    RegressionPreTrainedModel(a__      )

						__magic_name__						       =    TrainingArguments(self.output_dir			,				disable_tqdm=a__			,				report_to=[]			,				**a__      )
						return Trainer(
						    a__			,				a__			,				train_dataset=a__			,				eval_dataset=a__			,				callbacks=a__			,				)



	def 			snake_case__  (   self		:   Union[str, Any]			,				a__		:   Optional[int]			,				a__		:   Union[str, Any]      ):
						self.assertEqual(len(a__      )			,				len(a__      )      )

						# Order doesn't matter
						__magic_name__						       =    sorted(a__			,				key=lambda a__      : cb.__name__ if isinstance(a__			,				a__      ) else cb.__class__.__name__      )
						__magic_name__						       =    sorted(a__			,				key=lambda a__      : cb.__name__ if isinstance(a__			,				a__      ) else cb.__class__.__name__      )

						for cba, cba in zip(a__			,				a__      ):
											if isinstance(a__			,				a__      ) and isinstance(a__			,				a__      ):
																self.assertEqual(a__			,				a__      )
											elif isinstance(a__			,				a__      ) and not isinstance(a__			,				a__      ):
																self.assertEqual(a__			,				cba.__class__      )
											elif not isinstance(a__			,				a__      ) and isinstance(a__			,				a__      ):
																self.assertEqual(cba.__class__			,				a__      )
											else:
																self.assertEqual(a__			,				a__      )



	def 			snake_case__  (   self		:   Optional[Any]			,				a__		:   Tuple      ):
						__magic_name__						       =    ['''on_init_end''', '''on_train_begin''']
						__magic_name__						       =    0
						__magic_name__						       =    len(trainer.get_eval_dataloader()      )
						__magic_name__						       =    ['''on_prediction_step'''] * len(trainer.get_eval_dataloader()      ) + ['''on_log''', '''on_evaluate''']
						for _ in range(trainer.state.num_train_epochs      ):
											expected_events.append('''on_epoch_begin'''      )
											for _ in range(a__      ):
																step += 1
																expected_events += ["on_step_begin", "on_step_end"]
																if step % trainer.args.logging_steps == 0:
																					expected_events.append('''on_log'''      )
																if trainer.args.evaluation_strategy == IntervalStrategy.STEPS and step % trainer.args.eval_steps == 0:
																					expected_events += evaluation_events.copy()
																if step % trainer.args.save_steps == 0:
																					expected_events.append('''on_save'''      )
											expected_events.append('''on_epoch_end'''      )
											if trainer.args.evaluation_strategy == IntervalStrategy.EPOCH:
																expected_events += evaluation_events.copy()
						expected_events += ["on_log", "on_train_end"]
						return expected_events



	def 			snake_case__  (   self		:   List[str]      ):
						__magic_name__						       =    self.get_trainer()
						__magic_name__						       =    DEFAULT_CALLBACKS.copy() + [ProgressCallback]
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						# Callbacks passed at init are added to the default callbacks
						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]      )
						expected_callbacks.append(a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						# TrainingArguments.disable_tqdm controls if use ProgressCallback or PrinterCallback
						__magic_name__						       =    self.get_trainer(disable_tqdm=a__      )
						__magic_name__						       =    DEFAULT_CALLBACKS.copy() + [PrinterCallback]
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )



	def 			snake_case__  (   self		:   int      ):
						__magic_name__						       =    DEFAULT_CALLBACKS.copy() + [ProgressCallback]
						__magic_name__						       =    self.get_trainer()

						# We can add, pop, or remove by class name
						trainer.remove_callback(a__      )
						expected_callbacks.remove(a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						__magic_name__						       =    self.get_trainer()
						__magic_name__						       =    trainer.pop_callback(a__      )
						self.assertEqual(cb.__class__			,				a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						trainer.add_callback(a__      )
						expected_callbacks.insert(0			,				a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						# We can also add, pop, or remove by instance
						__magic_name__						       =    self.get_trainer()
						__magic_name__						       =    trainer.callback_handler.callbacks[0]
						trainer.remove_callback(a__      )
						expected_callbacks.remove(a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						__magic_name__						       =    self.get_trainer()
						__magic_name__						       =    trainer.callback_handler.callbacks[0]
						__magic_name__						       =    trainer.pop_callback(a__      )
						self.assertEqual(a__			,				a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )

						trainer.add_callback(a__      )
						expected_callbacks.insert(0			,				a__      )
						self.check_callbacks_equality(trainer.callback_handler.callbacks			,				a__      )



	def 			snake_case__  (   self		:   str      ):
						import warnings

						# XXX: for now ignore scatter_gather warnings in this test since it's not relevant to what's being tested
						warnings.simplefilter(action='''ignore'''			,				category=a__      )

						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]      )
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						# Independent log/save/eval
						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]			,				logging_steps=5      )
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]			,				save_steps=5      )
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]			,				eval_steps=5			,				evaluation_strategy='''steps'''      )
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						__magic_name__						       =    self.get_trainer(callbacks=[MyTestTrainerCallback]			,				evaluation_strategy='''epoch'''      )
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						# A bit of everything
						__magic_name__						       =    self.get_trainer(
						    callbacks=[MyTestTrainerCallback]			,				logging_steps=3			,				save_steps=10			,				eval_steps=5			,				evaluation_strategy='''steps'''			,				)
						trainer.train()
						__magic_name__						       =    trainer.callback_handler.callbacks[-2].events
						self.assertEqual(a__			,				self.get_expected_events(a__      )      )

						# warning should be emitted for duplicated callbacks
						with patch('''transformers.trainer_callback.logger.warning'''      ) as warn_mock:
											__magic_name__						       =    self.get_trainer(
											    callbacks=[MyTestTrainerCallback, MyTestTrainerCallback]			,				)
											assert str(a__      ) in warn_mock.call_args[0][0]









'''simple docstring'''




import unittest

import numpy as np
from datasets import load_dataset

from transformers.testing_utils import require_torch, require_vision
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 BeitImageProcessor






class   _SCREAMING_SNAKE_CASE   (   unittest.TestCase     ):



 def __init__(   self		:   Tuple			,				a__		:   Union[str, Any]			,				a__		:   Union[str, Any]=7			,				a__		:   Dict=3			,				a__		:   Optional[Any]=18			,				a__		:   Optional[Any]=30			,				a__		:   Tuple=400			,				a__		:   Optional[int]=True			,				a__		:   int=None			,				a__		:   Union[str, Any]=True			,				a__		:   Optional[Any]=None			,				a__		:   str=True			,				a__		:   List[Any]=[0.5, 0.5, 0.5]			,				a__		:   Tuple=[0.5, 0.5, 0.5]			,				a__		:   Union[str, Any]=False			,				):
      __magic_name__						       =    size if size is not None else {'''height''': 20, '''width''': 20}
      __magic_name__						       =    crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}
      __magic_name__						       =    parent
      __magic_name__						       =    batch_size
      __magic_name__						       =    num_channels
      __magic_name__						       =    image_size
      __magic_name__						       =    min_resolution
      __magic_name__						       =    max_resolution
      __magic_name__						       =    do_resize
      __magic_name__						       =    size
      __magic_name__						       =    do_center_crop
      __magic_name__						       =    crop_size
      __magic_name__						       =    do_normalize
      __magic_name__						       =    image_mean
      __magic_name__						       =    image_std
      __magic_name__						       =    do_reduce_labels



 def 			snake_case__  (   self		:   Optional[Any]      ):
      return {
          "do_resize": self.do_resize,
          "size": self.size,
          "do_center_crop": self.do_center_crop,
          "crop_size": self.crop_size,
          "do_normalize": self.do_normalize,
          "image_mean": self.image_mean,
          "image_std": self.image_std,
          "do_reduce_labels": self.do_reduce_labels,
      }




def 						UpperCamelCase	(			)				->     str:






     '''simple docstring'''
     __magic_name__						       =    load_dataset('''hf-internal-testing/fixtures_ade20k'''		,						split='''test'''			)

     __magic_name__						       =    Image.open(dataset[0]['''file''']			)
     __magic_name__						       =    Image.open(dataset[1]['''file''']			)

     return image, map




def 						UpperCamelCase	(			)				->     List[str]:






     '''simple docstring'''
     __magic_name__						       =    load_dataset('''hf-internal-testing/fixtures_ade20k'''		,						split='''test'''			)

     __magic_name__						       =    Image.open(ds[0]['''file''']			)
     __magic_name__						       =    Image.open(ds[1]['''file''']			)
     __magic_name__						       =    Image.open(ds[2]['''file''']			)
     __magic_name__						       =    Image.open(ds[3]['''file''']			)

     return [imagea, imagea], [mapa, mapa]






@require_torch
@require_vision
class   _SCREAMING_SNAKE_CASE   (   __a		,unittest.TestCase     ):
 __SCREAMING_SNAKE_CASE					:Optional[Any]      	=					BeitImageProcessor if is_vision_available() else None



 def 			snake_case__  (   self		:   Dict      ):
      __magic_name__						       =    BeitImageProcessingTester(self      )



 @property
 def 			snake_case__  (   self		:   Dict      ):
      return self.image_processor_tester.prepare_image_processor_dict()



 def 			snake_case__  (   self		:   Optional[Any]      ):
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )
      self.assertTrue(hasattr(a__			,				'''do_resize'''      )      )
      self.assertTrue(hasattr(a__			,				'''size'''      )      )
      self.assertTrue(hasattr(a__			,				'''do_center_crop'''      )      )
      self.assertTrue(hasattr(a__			,				'''center_crop'''      )      )
      self.assertTrue(hasattr(a__			,				'''do_normalize'''      )      )
      self.assertTrue(hasattr(a__			,				'''image_mean'''      )      )
      self.assertTrue(hasattr(a__			,				'''image_std'''      )      )



 def 			snake_case__  (   self		:   int      ):
      __magic_name__						       =    self.image_processing_class.from_dict(self.image_processor_dict      )
      self.assertEqual(image_processor.size			,				{'''height''': 20, '''width''': 20}      )
      self.assertEqual(image_processor.crop_size			,				{'''height''': 18, '''width''': 18}      )
      self.assertEqual(image_processor.do_reduce_labels			,				a__      )

      __magic_name__						       =    self.image_processing_class.from_dict(
          self.image_processor_dict			,				size=42			,				crop_size=84			,				reduce_labels=a__      )
      self.assertEqual(image_processor.size			,				{'''height''': 42, '''width''': 42}      )
      self.assertEqual(image_processor.crop_size			,				{'''height''': 84, '''width''': 84}      )
      self.assertEqual(image_processor.do_reduce_labels			,				a__      )



 def 			snake_case__  (   self		:   Optional[Any]      ):
      pass



 def 			snake_case__  (   self		:   Dict      ):
      # Initialize image_processing
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )
      # create random PIL images
      __magic_name__						       =    prepare_image_inputs(self.image_processor_tester			,				equal_resolution=a__      )
      for image in image_inputs:
           self.assertIsInstance(a__			,				Image.Image      )

      # Test not batched input
      __magic_name__						       =    image_processing(image_inputs[0]			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)

      # Test batched
      __magic_name__						       =    image_processing(a__			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)



 def 			snake_case__  (   self		:   Optional[int]      ):
      # Initialize image_processing
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )
      # create random numpy tensors
      __magic_name__						       =    prepare_image_inputs(self.image_processor_tester			,				equal_resolution=a__			,				numpify=a__      )
      for image in image_inputs:
           self.assertIsInstance(a__			,				np.ndarray      )

      # Test not batched input
      __magic_name__						       =    image_processing(image_inputs[0]			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)

      # Test batched
      __magic_name__						       =    image_processing(a__			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)



 def 			snake_case__  (   self		:   List[str]      ):
      # Initialize image_processing
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )
      # create random PyTorch tensors
      __magic_name__						       =    prepare_image_inputs(self.image_processor_tester			,				equal_resolution=a__			,				torchify=a__      )
      for image in image_inputs:
           self.assertIsInstance(a__			,				torch.Tensor      )

      # Test not batched input
      __magic_name__						       =    image_processing(image_inputs[0]			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)

      # Test batched
      __magic_name__						       =    image_processing(a__			,				return_tensors='''pt'''      ).pixel_values
      self.assertEqual(
          encoded_images.shape			,				(
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)



 def 			snake_case__  (   self		:   Union[str, Any]      ):
      # Initialize image_processing
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )
      # create random PyTorch tensors
      __magic_name__						       =    prepare_image_inputs(self.image_processor_tester			,				equal_resolution=a__			,				torchify=a__      )
      __magic_name__						       =    []
      for image in image_inputs:
           self.assertIsInstance(a__			,				torch.Tensor      )
           maps.append(torch.zeros(image.shape[-2:]      ).long()      )

      # Test not batched input
      __magic_name__						       =    image_processing(image_inputs[0]			,				maps[0]			,				return_tensors='''pt'''      )
      self.assertEqual(
          encoding['''pixel_values'''].shape			,				(
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(
          encoding['''labels'''].shape			,				(
              1,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(encoding['''labels'''].dtype			,				torch.long      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 255      )

      # Test batched
      __magic_name__						       =    image_processing(a__			,				a__			,				return_tensors='''pt'''      )
      self.assertEqual(
          encoding['''pixel_values'''].shape			,				(
              self.image_processor_tester.batch_size,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(
          encoding['''labels'''].shape			,				(
              self.image_processor_tester.batch_size,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(encoding['''labels'''].dtype			,				torch.long      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 255      )

      # Test not batched input (PIL images)
      __magic_name__       ,  __magic_name__						       =    prepare_semantic_single_inputs()

      __magic_name__						       =    image_processing(a__			,				a__			,				return_tensors='''pt'''      )
      self.assertEqual(
          encoding['''pixel_values'''].shape			,				(
              1,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(
          encoding['''labels'''].shape			,				(
              1,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(encoding['''labels'''].dtype			,				torch.long      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 255      )

      # Test batched input (PIL images)
      __magic_name__       ,  __magic_name__						       =    prepare_semantic_batch_inputs()

      __magic_name__						       =    image_processing(a__			,				a__			,				return_tensors='''pt'''      )
      self.assertEqual(
          encoding['''pixel_values'''].shape			,				(
              2,
              self.image_processor_tester.num_channels,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(
          encoding['''labels'''].shape			,				(
              2,
              self.image_processor_tester.crop_size['''height'''],
              self.image_processor_tester.crop_size['''width'''],
          )			,				)
      self.assertEqual(encoding['''labels'''].dtype			,				torch.long      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 255      )



 def 			snake_case__  (   self		:   Any      ):
      # Initialize image_processing
      __magic_name__						       =    self.image_processing_class(**self.image_processor_dict      )

      # ADE20k has 150 classes, and the background is included, so labels should be between 0 and 150
      __magic_name__       ,  __magic_name__						       =    prepare_semantic_single_inputs()
      __magic_name__						       =    image_processing(a__			,				a__			,				return_tensors='''pt'''      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 150      )

      __magic_name__						       =    True
      __magic_name__						       =    image_processing(a__			,				a__			,				return_tensors='''pt'''      )
      self.assertTrue(encoding['''labels'''].min().item() >= 0      )
      self.assertTrue(encoding['''labels'''].max().item() <= 255      )






