






import unittest

from transformers.utils.backbone_utils import (
    BackboneMixin,
    get_aligned_output_features_output_indices,
    verify_out_features_out_indices,
)


class        __UpperCamelCase    (     unittest.TestCase   ):







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







		__lowercase             =  ["""a""", """b""", """c"""]

		# Defaults to last layer if both are None
		__lowercase       ,						__lowercase             =  get_aligned_output_features_output_indices(_lowerCAmelCase       ,				_lowerCAmelCase       ,				_lowerCAmelCase			)
		self.assertEqual(_lowerCAmelCase       ,				["""c"""]			)
		self.assertEqual(_lowerCAmelCase       ,				[2]			)

		# Out indices set to match out features
		__lowercase       ,						__lowercase             =  get_aligned_output_features_output_indices(["""a""", """c"""]       ,				_lowerCAmelCase       ,				_lowerCAmelCase			)
		self.assertEqual(_lowerCAmelCase       ,				["""a""", """c"""]			)
		self.assertEqual(_lowerCAmelCase       ,				[0, 2]			)

		# Out features set to match out indices
		__lowercase       ,						__lowercase             =  get_aligned_output_features_output_indices(_lowerCAmelCase       ,				[0, 2]       ,				_lowerCAmelCase			)
		self.assertEqual(_lowerCAmelCase       ,				["""a""", """c"""]			)
		self.assertEqual(_lowerCAmelCase       ,				[0, 2]			)

		# Out features selected from negative indices
		__lowercase       ,						__lowercase             =  get_aligned_output_features_output_indices(_lowerCAmelCase       ,				[-3, -1]       ,				_lowerCAmelCase			)
		self.assertEqual(_lowerCAmelCase       ,				["""a""", """c"""]			)
		self.assertEqual(_lowerCAmelCase       ,				[-3, -1]			)







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







		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(["""a""", """b"""]       ,				(0, 1)       ,				_lowerCAmelCase			)

		# Out features must be a list
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(("""a""", """b""")       ,				(0, 1)       ,				["""a""", """b"""]			)

		# Out features must be a subset of stage names
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(["""a""", """b"""]       ,				(0, 1)       ,				["""a"""]			)

		# Out indices must be a list or tuple
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(_lowerCAmelCase       ,				0       ,				["""a""", """b"""]			)

		# Out indices must be a subset of stage names
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(_lowerCAmelCase       ,				(0, 1)       ,				["""a"""]			)

		# Out features and out indices must be the same length
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(["""a""", """b"""]       ,				(0,)       ,				["""a""", """b""", """c"""]			)

		# Out features should match out indices
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(["""a""", """b"""]       ,				(0, 2)       ,				["""a""", """b""", """c"""]			)

		# Out features and out indices should be in order
		with self.assertRaises(_lowerCAmelCase			):
			verify_out_features_out_indices(["""b""", """a"""]       ,				(0, 1)       ,				["""a""", """b"""]			)

		# Check passes with valid inputs
		verify_out_features_out_indices(["""a""", """b""", """d"""]       ,				(0, 1, -1)       ,				["""a""", """b""", """c""", """d"""]			)







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







		__lowercase             =  BackboneMixin()

		__lowercase             =  ["""a""", """b""", """c"""]
		__lowercase             =  ["""a""", """c"""]
		__lowercase             =  [0, 2]

		# Check that the output features and indices are set correctly
		self.assertEqual(backbone.out_features       ,				["""a""", """c"""]			)
		self.assertEqual(backbone.out_indices       ,				[0, 2]			)

		# Check out features and indices are updated correctly
		__lowercase             =  ["""a""", """b"""]
		self.assertEqual(backbone.out_features       ,				["""a""", """b"""]			)
		self.assertEqual(backbone.out_indices       ,				[0, 1]			)

		__lowercase             =  [-3, -1]
		self.assertEqual(backbone.out_features       ,				["""a""", """c"""]			)
		self.assertEqual(backbone.out_indices       ,				[-3, -1]			)














def 				snake_case  (     lowerCamelCase					):




	'''simple docstring'''







	if not isinstance(lowerCamelCase				,  lowerCamelCase					):
		raise ValueError("""check_bouncy() accepts only integer arguments"""					)
	__lowercase             =  str(lowerCamelCase					)
	__lowercase             =  """""".join(sorted(lowerCamelCase					)					)
	return sorted_str_n != str_n and sorted_str_n[::-1] != str_n





def 				snake_case  (     lowerCamelCase = 99					):




	'''simple docstring'''







	if not 0 < percent < 100:
		raise ValueError("""solution() only accepts values from 0 to 100"""					)
	__lowercase             =  0
	__lowercase             =  1

	while True:
		if check_bouncy(lowerCamelCase					):
			bouncy_num += 1
		if (bouncy_num / num) * 100 >= percent:
			return num
		num += 1


if __name__ == "__main__":
						from doctest import testmod

						testmod()
						print(F'''{solution(99)}''')

