
'''simple docstring'''







import unittest

from transformers import AutoTokenizer, NystromformerConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

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


if is_torch_available():
						import torch

						from transformers import (
						    NystromformerForMaskedLM,
						    NystromformerForMultipleChoice,
						    NystromformerForQuestionAnswering,
						    NystromformerForSequenceClassification,
						    NystromformerForTokenClassification,
						    NystromformerModel,
						)
						from transformers.models.nystromformer.modeling_nystromformer import NYSTROMFORMER_PRETRAINED_MODEL_ARCHIVE_LIST


class 			lowerCAmelCase :




		def __init__(				self					,						UpperCamelCase					,						UpperCamelCase=13					,						UpperCamelCase=7					,						UpperCamelCase=True					,						UpperCamelCase=True					,						UpperCamelCase=True					,						UpperCamelCase=True					,						UpperCamelCase=99					,						UpperCamelCase=32					,						UpperCamelCase=5					,						UpperCamelCase=4					,						UpperCamelCase=37					,						UpperCamelCase="gelu"					,						UpperCamelCase=0.1					,						UpperCamelCase=0.1					,						UpperCamelCase=512					,						UpperCamelCase=16					,						UpperCamelCase=2					,						UpperCamelCase=0.02					,						UpperCamelCase=3					,						UpperCamelCase=4					,						UpperCamelCase=None					,						):
								_SCREAMING_SNAKE_CASE				= parent
								_SCREAMING_SNAKE_CASE				= batch_size
								_SCREAMING_SNAKE_CASE				= seq_length
								_SCREAMING_SNAKE_CASE				= is_training
								_SCREAMING_SNAKE_CASE				= use_input_mask
								_SCREAMING_SNAKE_CASE				= use_token_type_ids
								_SCREAMING_SNAKE_CASE				= use_labels
								_SCREAMING_SNAKE_CASE				= vocab_size
								_SCREAMING_SNAKE_CASE				= hidden_size
								_SCREAMING_SNAKE_CASE				= num_hidden_layers
								_SCREAMING_SNAKE_CASE				= num_attention_heads
								_SCREAMING_SNAKE_CASE				= intermediate_size
								_SCREAMING_SNAKE_CASE				= hidden_act
								_SCREAMING_SNAKE_CASE				= hidden_dropout_prob
								_SCREAMING_SNAKE_CASE				= attention_probs_dropout_prob
								_SCREAMING_SNAKE_CASE				= max_position_embeddings
								_SCREAMING_SNAKE_CASE				= type_vocab_size
								_SCREAMING_SNAKE_CASE				= type_sequence_label_size
								_SCREAMING_SNAKE_CASE				= initializer_range
								_SCREAMING_SNAKE_CASE				= num_labels
								_SCREAMING_SNAKE_CASE				= num_choices
								_SCREAMING_SNAKE_CASE				= scope




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= ids_tensor([self.batch_size, self.seq_length]					,						self.vocab_size      )

								_SCREAMING_SNAKE_CASE				= None
								if self.use_input_mask:
														_SCREAMING_SNAKE_CASE				= random_attention_mask([self.batch_size, self.seq_length]      )

								_SCREAMING_SNAKE_CASE				= None
								if self.use_token_type_ids:
														_SCREAMING_SNAKE_CASE				= ids_tensor([self.batch_size, self.seq_length]					,						self.type_vocab_size      )

								_SCREAMING_SNAKE_CASE				= None
								_SCREAMING_SNAKE_CASE				= None
								_SCREAMING_SNAKE_CASE				= None
								if self.use_labels:
														_SCREAMING_SNAKE_CASE				= ids_tensor([self.batch_size]					,						self.type_sequence_label_size      )
														_SCREAMING_SNAKE_CASE				= ids_tensor([self.batch_size, self.seq_length]					,						self.num_labels      )
														_SCREAMING_SNAKE_CASE				= ids_tensor([self.batch_size]					,						self.num_choices      )

								_SCREAMING_SNAKE_CASE				= self.get_config()

								return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels




		def     lowercase       (				self      ):
								return NystromformerConfig(
								    vocab_size=self.vocab_size					,						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					,						max_position_embeddings=self.max_position_embeddings					,						type_vocab_size=self.type_vocab_size					,						is_decoder=UpperCamelCase					,						initializer_range=self.initializer_range					,						)




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= NystromformerModel(config=UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase					,						token_type_ids=UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase      )
								self.parent.assertEqual(result.last_hidden_state.shape					,						(self.batch_size, self.seq_length, self.hidden_size)      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= NystromformerForMaskedLM(config=UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase					,						labels=UpperCamelCase      )
								self.parent.assertEqual(result.logits.shape					,						(self.batch_size, self.seq_length, self.vocab_size)      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= NystromformerForQuestionAnswering(config=UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= model(
								    UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase					,						start_positions=UpperCamelCase					,						end_positions=UpperCamelCase					,						)
								self.parent.assertEqual(result.start_logits.shape					,						(self.batch_size, self.seq_length)      )
								self.parent.assertEqual(result.end_logits.shape					,						(self.batch_size, self.seq_length)      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= self.num_labels
								_SCREAMING_SNAKE_CASE				= NystromformerForSequenceClassification(UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase					,						labels=UpperCamelCase      )
								self.parent.assertEqual(result.logits.shape					,						(self.batch_size, self.num_labels)      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= self.num_labels
								_SCREAMING_SNAKE_CASE				= NystromformerForTokenClassification(config=UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= model(UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase					,						labels=UpperCamelCase      )
								self.parent.assertEqual(result.logits.shape					,						(self.batch_size, self.seq_length, self.num_labels)      )




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= self.num_choices
								_SCREAMING_SNAKE_CASE				= NystromformerForMultipleChoice(config=UpperCamelCase      )
								model.to(UpperCamelCase      )
								model.eval()
								_SCREAMING_SNAKE_CASE				= input_ids.unsqueeze(1      ).expand(-1					,						self.num_choices					,						-1      ).contiguous()
								_SCREAMING_SNAKE_CASE				= token_type_ids.unsqueeze(1      ).expand(-1					,						self.num_choices					,						-1      ).contiguous()
								_SCREAMING_SNAKE_CASE				= input_mask.unsqueeze(1      ).expand(-1					,						self.num_choices					,						-1      ).contiguous()
								_SCREAMING_SNAKE_CASE				= model(
								    UpperCamelCase					,						attention_mask=UpperCamelCase					,						token_type_ids=UpperCamelCase					,						labels=UpperCamelCase					,						)
								self.parent.assertEqual(result.logits.shape					,						(self.batch_size, self.num_choices)      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.prepare_config_and_inputs()
								(
								    (
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							(
								    _SCREAMING_SNAKE_CASE
								),							
								)				= config_and_inputs
								_SCREAMING_SNAKE_CASE				= {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
								return config, inputs_dict


@require_torch
class 			lowerCAmelCase (				__UpperCAmelCase		,     __UpperCAmelCase		,     unittest.TestCase			):
		a							:					Union[str, Any]       =					(
		    (
		        NystromformerModel,
		        NystromformerForMaskedLM,
		        NystromformerForMultipleChoice,
		        NystromformerForQuestionAnswering,
		        NystromformerForSequenceClassification,
		        NystromformerForTokenClassification,
		    )
		    if is_torch_available()
		    else ()
		)
		a							:					Union[str, Any]       =					(
		    {
		        """feature-extraction""": NystromformerModel,
		        """fill-mask""": NystromformerForMaskedLM,
		        """question-answering""": NystromformerForQuestionAnswering,
		        """text-classification""": NystromformerForSequenceClassification,
		        """token-classification""": NystromformerForTokenClassification,
		        """zero-shot""": NystromformerForSequenceClassification,
		    }
		    if is_torch_available()
		    else {}
		)
		a							:					Dict       =					False
		a							:					int       =					False




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= NystromformerModelTester(self      )
								_SCREAMING_SNAKE_CASE				= ConfigTester(self					,						config_class=UpperCamelCase					,						hidden_size=37      )




		def     lowercase       (				self      ):
								self.config_tester.run_common_tests()




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								for type in ["absolute", "relative_key", "relative_key_query"]:
														_SCREAMING_SNAKE_CASE				= type
														self.model_tester.create_and_check_model(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_lm(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_multiple_choice(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_question_answering(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_sequence_classification(*UpperCamelCase      )




		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_token_classification(*UpperCamelCase      )




		@slow
		def     lowercase       (				self      ):
								for model_name in NYSTROMFORMER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
														_SCREAMING_SNAKE_CASE				= NystromformerModel.from_pretrained(UpperCamelCase      )
														self.assertIsNotNone(UpperCamelCase      )


@require_torch
class 			lowerCAmelCase (				unittest.TestCase			):




		@slow
		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= NystromformerModel.from_pretrained("uw-madison/nystromformer-512"      )
								_SCREAMING_SNAKE_CASE				= torch.tensor([[0, 1, 2, 3, 4, 5]]      )

								with torch.no_grad():
														_SCREAMING_SNAKE_CASE				= model(UpperCamelCase      )[0]

								_SCREAMING_SNAKE_CASE				= torch.Size((1, 6, 768)      )
								self.assertEqual(output.shape					,						UpperCamelCase      )

								_SCREAMING_SNAKE_CASE				= torch.tensor(
								    [[[-0.45_32, -0.09_36, 0.51_37], [-0.26_76, 0.06_28, 0.61_86], [-0.36_29, -0.17_26, 0.47_16]]]      )

								self.assertTrue(torch.allclose(output[:, :3, :3]					,						UpperCamelCase					,						atol=1e-4      )      )




		@slow
		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= "the [MASK] of Belgium is Brussels"

								_SCREAMING_SNAKE_CASE				= AutoTokenizer.from_pretrained("uw-madison/nystromformer-512"      )
								_SCREAMING_SNAKE_CASE				= NystromformerForMaskedLM.from_pretrained("uw-madison/nystromformer-512"      )

								_SCREAMING_SNAKE_CASE				= tokenizer(UpperCamelCase					,						return_tensors="pt"      )

								with torch.no_grad():
														_SCREAMING_SNAKE_CASE				= model(encoding.input_ids      ).logits

								_SCREAMING_SNAKE_CASE				= token_logits[:, 2, :].argmax(-1      )[0]

								self.assertEqual(tokenizer.decode(UpperCamelCase      )					,						"capital"      )

'''simple docstring'''







from copy import deepcopy
from typing import Optional, Union

import numpy as np

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, is_tf_available, is_torch_available


if is_torch_available():
						import torch

if is_tf_available():
						import tensorflow as tf


class 			lowerCAmelCase (				__UpperCAmelCase			):
		a							:					Optional[int]       =					["""image_processor"""]
		a							:					Tuple       =					"""SamImageProcessor"""




		def __init__(				self					,						UpperCamelCase      ):
								super().__init__(UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= self.image_processor
								_SCREAMING_SNAKE_CASE				= -10
								_SCREAMING_SNAKE_CASE				= self.image_processor.size["longest_edge"]




		def __call__(				self					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase = None					,						**UpperCamelCase					,						):
								_SCREAMING_SNAKE_CASE				= self.image_processor(
								    UpperCamelCase					,						return_tensors=UpperCamelCase					,						**UpperCamelCase					,						)

								# pop arguments that are not used in the foward but used nevertheless
								_SCREAMING_SNAKE_CASE				= encoding_image_processor["original_sizes"]

								if hasattr(UpperCamelCase					,						"numpy"      ):  # Checks if Torch or TF tensor
														_SCREAMING_SNAKE_CASE				= original_sizes.numpy()

								_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE				= self._check_and_preprocess_points(
								    input_points=UpperCamelCase					,						input_labels=UpperCamelCase					,						input_boxes=UpperCamelCase					,						)

								_SCREAMING_SNAKE_CASE				= self._normalize_and_convert(
								    UpperCamelCase					,						UpperCamelCase					,						input_points=UpperCamelCase					,						input_labels=UpperCamelCase					,						input_boxes=UpperCamelCase					,						return_tensors=UpperCamelCase					,						)

								return encoding_image_processor




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase="pt"					,						):
								if input_points is not None:
														if len(UpperCamelCase      ) != len(UpperCamelCase      ):
																				_SCREAMING_SNAKE_CASE				= [
																				    self._normalize_coordinates(self.target_size					,						UpperCamelCase					,						original_sizes[0]      ) for point in input_points
																				]
														else:
																				_SCREAMING_SNAKE_CASE				= [
																				    self._normalize_coordinates(self.target_size					,						UpperCamelCase					,						UpperCamelCase      )
																				    for point, original_size in zip(UpperCamelCase					,						UpperCamelCase      )
																				]
														# check that all arrays have the same shape
														if not all(point.shape == input_points[0].shape for point in input_points      ):
																				if input_labels is not None:
																										_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE				= self._pad_points_and_labels(UpperCamelCase					,						UpperCamelCase      )

														_SCREAMING_SNAKE_CASE				= np.array(UpperCamelCase      )

								if input_labels is not None:
														_SCREAMING_SNAKE_CASE				= np.array(UpperCamelCase      )

								if input_boxes is not None:
														if len(UpperCamelCase      ) != len(UpperCamelCase      ):
																				_SCREAMING_SNAKE_CASE				= [
																				    self._normalize_coordinates(self.target_size					,						UpperCamelCase					,						original_sizes[0]					,						is_bounding_box=UpperCamelCase      )
																				    for box in input_boxes
																				]
														else:
																				_SCREAMING_SNAKE_CASE				= [
																				    self._normalize_coordinates(self.target_size					,						UpperCamelCase					,						UpperCamelCase					,						is_bounding_box=UpperCamelCase      )
																				    for box, original_size in zip(UpperCamelCase					,						UpperCamelCase      )
																				]
														_SCREAMING_SNAKE_CASE				= np.array(UpperCamelCase      )

								if input_boxes is not None:
														if return_tensors == "pt":
																				_SCREAMING_SNAKE_CASE				= torch.from_numpy(UpperCamelCase      )
																				# boxes batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= input_boxes.unsqueeze(1      ) if len(input_boxes.shape      ) != 3 else input_boxes
														elif return_tensors == "tf":
																				_SCREAMING_SNAKE_CASE				= tf.convert_to_tensor(UpperCamelCase      )
																				# boxes batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= tf.expand_dims(UpperCamelCase					,						1      ) if len(input_boxes.shape      ) != 3 else input_boxes
														encoding_image_processor.update({"input_boxes": input_boxes}      )
								if input_points is not None:
														if return_tensors == "pt":
																				_SCREAMING_SNAKE_CASE				= torch.from_numpy(UpperCamelCase      )
																				# point batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= input_points.unsqueeze(1      ) if len(input_points.shape      ) != 4 else input_points
														elif return_tensors == "tf":
																				_SCREAMING_SNAKE_CASE				= tf.convert_to_tensor(UpperCamelCase      )
																				# point batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= tf.expand_dims(UpperCamelCase					,						1      ) if len(input_points.shape      ) != 4 else input_points
														encoding_image_processor.update({"input_points": input_points}      )
								if input_labels is not None:
														if return_tensors == "pt":
																				_SCREAMING_SNAKE_CASE				= torch.from_numpy(UpperCamelCase      )
																				# point batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= input_labels.unsqueeze(1      ) if len(input_labels.shape      ) != 3 else input_labels
														elif return_tensors == "tf":
																				_SCREAMING_SNAKE_CASE				= tf.convert_to_tensor(UpperCamelCase      )
																				# point batch size of 1 by default
																				_SCREAMING_SNAKE_CASE				= tf.expand_dims(UpperCamelCase					,						1      ) if len(input_labels.shape      ) != 3 else input_labels
														encoding_image_processor.update({"input_labels": input_labels}      )

								return encoding_image_processor




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase      ):
								_SCREAMING_SNAKE_CASE				= max([point.shape[0] for point in input_points]      )
								_SCREAMING_SNAKE_CASE				= []
								for i, point in enumerate(UpperCamelCase      ):
														if point.shape[0] != expected_nb_points:
																				_SCREAMING_SNAKE_CASE				= np.concatenate(
																				    [point, np.zeros((expected_nb_points - point.shape[0], 2)      ) + self.point_pad_value]					,						axis=0      )
																				_SCREAMING_SNAKE_CASE				= np.append(input_labels[i]					,						[self.point_pad_value]      )
														processed_input_points.append(UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= processed_input_points
								return input_points, input_labels




		def     lowercase       (				self					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase					,						UpperCamelCase=False      ):
								_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE				= original_size
								_SCREAMING_SNAKE_CASE,							_SCREAMING_SNAKE_CASE				= self.image_processor._get_preprocess_shape(UpperCamelCase					,						longest_edge=UpperCamelCase      )
								_SCREAMING_SNAKE_CASE				= deepcopy(UpperCamelCase      ).astype(UpperCamelCase      )

								if is_bounding_box:
														_SCREAMING_SNAKE_CASE				= coords.reshape(-1					,						2					,						2      )

								_SCREAMING_SNAKE_CASE				= coords[..., 0] * (new_w / old_w)
								_SCREAMING_SNAKE_CASE				= coords[..., 1] * (new_h / old_h)

								if is_bounding_box:
														_SCREAMING_SNAKE_CASE				= coords.reshape(-1					,						4      )

								return coords




		def     lowercase       (				self					,						UpperCamelCase=None					,						UpperCamelCase=None					,						UpperCamelCase=None					,						):
								if input_points is not None:
														if hasattr(UpperCamelCase					,						"numpy"      ):  # Checks for TF or Torch tensor
																				_SCREAMING_SNAKE_CASE				= input_points.numpy().tolist()

														if not isinstance(UpperCamelCase					,						UpperCamelCase      ) or not isinstance(input_points[0]					,						UpperCamelCase      ):
																				raise ValueError("Input points must be a list of list of floating points."      )
														_SCREAMING_SNAKE_CASE				= [np.array(UpperCamelCase      ) for input_point in input_points]
								else:
														_SCREAMING_SNAKE_CASE				= None

								if input_labels is not None:
														if hasattr(UpperCamelCase					,						"numpy"      ):
																				_SCREAMING_SNAKE_CASE				= input_labels.numpy().tolist()

														if not isinstance(UpperCamelCase					,						UpperCamelCase      ) or not isinstance(input_labels[0]					,						UpperCamelCase      ):
																				raise ValueError("Input labels must be a list of list integers."      )
														_SCREAMING_SNAKE_CASE				= [np.array(UpperCamelCase      ) for label in input_labels]
								else:
														_SCREAMING_SNAKE_CASE				= None

								if input_boxes is not None:
														if hasattr(UpperCamelCase					,						"numpy"      ):
																				_SCREAMING_SNAKE_CASE				= input_boxes.numpy().tolist()

														if (
														    not isinstance(UpperCamelCase					,						UpperCamelCase      )
														    or not isinstance(input_boxes[0]					,						UpperCamelCase      )
														    or not isinstance(input_boxes[0][0]					,						UpperCamelCase      )
														):
																				raise ValueError("Input boxes must be a list of list of list of floating points."      )
														_SCREAMING_SNAKE_CASE				= [np.array(UpperCamelCase      ).astype(np.floataa      ) for box in input_boxes]
								else:
														_SCREAMING_SNAKE_CASE				= None

								return input_points, input_labels, input_boxes




		@property
		def     lowercase       (				self      ):
								_SCREAMING_SNAKE_CASE				= self.image_processor.model_input_names
								return list(dict.fromkeys(UpperCamelCase      )      )




		def     lowercase       (				self					,						*UpperCamelCase					,						**UpperCamelCase      ):
								return self.image_processor.post_process_masks(*UpperCamelCase					,						**UpperCamelCase      )