



"""simple docstring"""





from __future__ import annotations





def        a_  (   _lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float  ):





       '''simple docstring'''

       if days_between_payments <= 0:
              raise ValueError('days_between_payments must be > 0'  )
       if daily_interest_rate < 0:
              raise ValueError('daily_interest_rate must be >= 0'  )
       if principal <= 0:
              raise ValueError('principal must be > 0'  )
       return principal * daily_interest_rate * days_between_payments





def        a_  (   _lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				):





       '''simple docstring'''

       if number_of_compounding_periods <= 0:
              raise ValueError('number_of_compounding_periods must be > 0'  )
       if nominal_annual_interest_rate_percentage < 0:
              raise ValueError('nominal_annual_interest_rate_percentage must be >= 0'  )
       if principal <= 0:
              raise ValueError('principal must be > 0'  )

       return principal * (
           (1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
           - 1
       )





def        a_  (   _lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				_lowerCAmelCase						:				float     ,				):





       '''simple docstring'''

       if number_of_years <= 0:
              raise ValueError('number_of_years must be > 0'  )
       if nominal_annual_percentage_rate < 0:
              raise ValueError('nominal_annual_percentage_rate must be >= 0'  )
       if principal <= 0:
              raise ValueError('principal must be > 0'  )

       return compound_interest(
           _lowerCAmelCase     ,				nominal_annual_percentage_rate / 365     ,				number_of_years * 365  )


if __name__ == "__main__":
       import doctest

       doctest.testmod()


"""simple docstring"""





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):


      @slow
      def 	_UpperCAmelCase (     self							) ->      str:
             lowercase__    :	Optional[Any]     					=			AutoImageProcessor.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'							)
             lowercase__    :	Union[str, Any]     					=			AutoModelForImageClassification.from_pretrained('microsoft/dit-base-finetuned-rvlcdip'							)
             model.to(a							)

             from datasets import load_dataset

             lowercase__    :	str     					=			load_dataset('nielsr/rvlcdip-demo'							)

             lowercase__    :	Tuple     					=			dataset['train'][0]['image'].convert('RGB'							)

             lowercase__    :	int     					=			image_processor(a	,    return_tensors='pt'							).to(a							)

             # forward pass
             with torch.no_grad():
                    lowercase__    :	List[str]     					=			model(**a							)
                    lowercase__    :	List[Any]     					=			outputs.logits

             lowercase__    :	Union[str, Any]     					=			torch.Size((1, 1_6)							)
             self.assertEqual(logits.shape	,    a							)

             lowercase__    :	Tuple     					=			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							)							)

