






import unittest

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




class 				__A     (			unittest.TestCase ):





				"""simple docstring"""







				def       __lowercase							( self    ):




									"""simple docstring"""

									__UpperCamelCase      :					List[str]       		=['a', 'b', 'c']

									# Defaults to last layer if both are None
									__UpperCamelCase		,				__UpperCamelCase      :					List[str]       		=get_aligned_output_features_output_indices(lowerCamelCase__							,  lowerCamelCase__							,  lowerCamelCase__    )
									self.assertEqual(lowerCamelCase__							,  ['c']    )
									self.assertEqual(lowerCamelCase__							,  [2]    )

									# Out indices set to match out features
									__UpperCamelCase		,				__UpperCamelCase      :					List[Any]       		=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
									__UpperCamelCase		,				__UpperCamelCase      :					int       		=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
									__UpperCamelCase		,				__UpperCamelCase      :					Dict       		=get_aligned_output_features_output_indices(lowerCamelCase__							,  [-3, -1]							,  lowerCamelCase__    )
									self.assertEqual(lowerCamelCase__							,  ['a', 'c']    )
									self.assertEqual(lowerCamelCase__							,  [-3, -1]    )


				def       __lowercase							( self    ):




									"""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       __lowercase							( self    ):




									"""simple docstring"""

									__UpperCamelCase      :					int       		=BackboneMixin()

									__UpperCamelCase      :					Optional[Any]       		=['a', 'b', 'c']
									__UpperCamelCase      :					Dict       		=['a', 'c']
									__UpperCamelCase      :					Union[str, Any]       		=[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
									__UpperCamelCase      :					Tuple       		=['a', 'b']
									self.assertEqual(backbone.out_features							,  ['a', 'b']    )
									self.assertEqual(backbone.out_indices							,  [0, 1]    )

									__UpperCamelCase      :					Tuple       		=[-3, -1]
									self.assertEqual(backbone.out_features							,  ['a', 'c']    )
									self.assertEqual(backbone.out_indices							,  [-3, -1]    )





from math import isqrt
def 				UpperCAmelCase_					(							__snake_case						)     ->			list[int]:







 """simple docstring"""


 _lowercase							      =[True] * max_number
 for i in range(2     ,						isqrt(max_number - 1						) + 1						):
  if is_prime[i]:
   for j in range(i**2     ,						__snake_case     ,						__snake_case						):
    _lowercase							      =False

 return [i for i in range(2     ,						__snake_case						) if is_prime[i]]
def 				UpperCAmelCase_					(							__snake_case = 10**8						)     ->			int:







 """simple docstring"""


 _lowercase							      =calculate_prime_numbers(max_number // 2						)

 _lowercase							      =0
 _lowercase							      =0
 _lowercase							      =len(__snake_case						) - 1
 while left <= right:
  while prime_numbers[left] * prime_numbers[right] >= max_number:
   right -= 1
  semiprimes_count += right - left + 1
  left += 1

 return semiprimes_count


if __name__ == "__main__":
  print(f'''{solution() = }''')

