

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   lowercase_   (  unittest.TestCase					):



      @slow
      def 						UpperCamelCase_		(      self				:    str		)   ->					List[str]:
        _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.4158, -0.4092, -0.4347]      , device=A__      , dtype=torch.float      , )
        self.assertTrue(torch.allclose(logits[0, :3]      , A__      , atol=1e-4		)		)




import cmath
import math



def 				snake_case_(_UpperCamelCase			,	_UpperCamelCase			,	_UpperCamelCase			,	_UpperCamelCase					)							->     complex:



  """simple docstring"""






  _snake_case						=							math.radians(_UpperCamelCase					)
  _snake_case						=							math.radians(_UpperCamelCase					)

  # Convert voltage and current to rectangular form
  _snake_case						=							cmath.rect(_UpperCamelCase			,	_UpperCamelCase					)
  _snake_case						=							cmath.rect(_UpperCamelCase			,	_UpperCamelCase					)

  # Calculate apparent power
  return voltage_rect * current_rect


if __name__ == "__main__":
 import doctest

 doctest.testmod()

