


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





  """simple docstring"""




  @slow
  def 						snake_case	(					self  ):







   """simple docstring"""
   lowerCamelCase_  				=						AutoImageProcessor.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"  )
   lowerCamelCase_  				=						AutoModelForImageClassification.from_pretrained("microsoft/dit-base-finetuned-rvlcdip"  )
   model.to(UpperCamelCase  )

   from datasets import load_dataset

   lowerCamelCase_  				=						load_dataset("nielsr/rvlcdip-demo"  )

   lowerCamelCase_  				=						dataset["train"][0]["image"].convert("RGB"  )

   lowerCamelCase_  				=						image_processor(UpperCamelCase    ,						return_tensors="pt"  ).to(UpperCamelCase  )

   # forward pass
   with torch.no_grad():
    lowerCamelCase_  				=						model(**UpperCamelCase  )
    lowerCamelCase_  				=						outputs.logits

   lowerCamelCase_  				=						torch.Size((1, 16)  )
   self.assertEqual(logits.shape    ,						UpperCamelCase  )

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







'''simple docstring'''

def __snake_case      (   UpperCAmelCase_		:		int = 100	):
 lowerCamelCase_  				=						n * (n + 1) * (2 * n + 1) / 6
 lowerCamelCase_  				=						(n * (n + 1) / 2) ** 2
 return int(square_of_sum - sum_of_squares	)


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



