
'''simple docstring'''




from math import factorial, radians







def 		lowerCAmelCase_				(   snake_case__		,				snake_case__ = 18		,				snake_case__ = 10						):




    '''simple docstring'''



    A       :   List[str]					=						angle_in_degrees - ((angle_in_degrees // 3_60.0) * 3_60.0)

    # Converting from degrees to radians
    A       :   Optional[int]					=						radians(snake_case__						)

    A       :   List[str]					=						angle_in_radians
    A       :   Union[str, Any]					=						3
    A       :   int					=						-1

    for _ in range(snake_case__						):
        result += (b * (angle_in_radians**a)) / factorial(snake_case__						)

        A       :   Any					=						-b  # One positive term and the next will be negative and so on...
        a += 2  # Increased by 2 for every term.

    return round(snake_case__		,				snake_case__						)


if __name__ == "__main__":
      __import__('doctest').testmod()












import unittest

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


if is_torch_available():
	import torch

	from transformers import AutoModelForImageClassification

if is_vision_available():
	from transformers import AutoImageProcessor




@require_torch
@require_vision
class  UpperCamelCase_      (			unittest.TestCase				):



	'''simple docstring'''




	@slow
	def 							_UpperCamelCase			(       self					)       ->    int:
								snake_case_				=							AutoImageProcessor.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'					)
								snake_case_				=							AutoModelForImageClassification.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'					)
								model.to(a					)

								from datasets import load_dataset

								snake_case_				=							load_dataset('nielsr/rvlcdip-demo'					)

								snake_case_				=							dataset['train'][0]['image'].convert('RGB'					)

								snake_case_				=							image_processor(a       ,			return_tensors='pt'					).to(a					)

								# forward pass
								with torch.no_grad():
															snake_case_				=							model(**a					)
															snake_case_				=							outputs.logits

								snake_case_				=							torch.Size((1, 16)					)
								self.assertEqual(logits.shape       ,			a					)

								snake_case_				=							torch.tensor(
								    [-0.4_158, -0.4_092, -0.4_347]       ,			device=a       ,			dtype=torch.float       ,			)
								self.assertTrue(torch.allclose(logits[0, :3]       ,			a       ,			atol=1E-4					)					)





