





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



 @slow
 def 				UpperCamelCase			(							self ):
        A__											=						AutoImageProcessor.from_pretrained('''microsoft/dit-base-finetuned-rvlcdip''' )
        A__											=						AutoModelForImageClassification.from_pretrained('''microsoft/dit-base-finetuned-rvlcdip''' )
        model.to(lowercase_ )

        from datasets import load_dataset

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

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

        A__											=						image_processor(lowercase_,return_tensors='''pt''' ).to(lowercase_ )

        # forward pass
        with torch.no_grad():
               A__											=						model(**lowercase_ )
               A__											=						outputs.logits

        A__											=						torch.Size((1, 16) )
        self.assertEqual(logits.shape,lowercase_ )

        A__											=						torch.tensor(
            [-0.4158, -0.4092, -0.4347],device=lowercase_,dtype=torch.float,)
        self.assertTrue(torch.allclose(logits[0, :3],lowercase_,atol=1E-4 ) )






def 			lowercase_				(			_lowerCamelCase							:       int):
    lowercase__ :   Dict    					=				n ** (1 / 3)
    return (val * val * val) == n


if __name__ == "__main__":
      print(perfect_cube(27))
      print(perfect_cube(4))



