
'''simple docstring'''

from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow


if is_tf_available():
     import numpy as np
     import tensorflow as tf

     from transformers import TFXLMRobertaModel




@require_tf
@require_sentencepiece
@require_tokenizers
class    lowerCAmelCase       (     unittest.TestCase  ):


 @slow
 def    _A	(    self  : List[str]    ):
  '''simple docstring'''

  lowerCAmelCase__     :   int     		=	TFXLMRobertaModel.from_pretrained("jplu/tf-xlm-roberta-base"    )

  lowerCAmelCase__     :   str     		=	{
      "input_ids": tf.convert_to_tensor([[0, 2646, 1_0269, 83, 9_9942, 2]]			,							dtype=tf.intaa    ),  # "My dog is cute"
      "attention_mask": tf.convert_to_tensor([[1, 1, 1, 1, 1, 1]]			,							dtype=tf.intaa    ),
  }

  lowerCAmelCase__     :   Optional[Any]     		=	model(a__    )["last_hidden_state"]
  lowerCAmelCase__     :   List[Any]     		=	tf.TensorShape((1, 6, 768)    )
  self.assertEqual(output.shape			,							a__    )
  # compare the actual values for a slice.
  lowerCAmelCase__     :   str     		=	tf.convert_to_tensor(
      [
          [
              [0.0681762, 0.10894451, 0.06772504],
              [-0.06423668, 0.02366615, 0.04329344],
              [-0.06057295, 0.09974135, -0.00070584],
          ]
      ]			,							dtype=tf.floataa			,							)

  self.assertTrue(np.allclose(output[:, :3, :3].numpy()			,							expected_slice.numpy()			,							atol=1e-4    )    )







'''simple docstring'''

from cva import destroyAllWindows, imread, imshow, waitKey


def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__		,     lowerCAmelCase__     :   Tuple     		=	img.shape[0], img.shape[1]

 # converting each pixel's color to its negative
 for i in range(lowerCamelCase_			):
  for j in range(lowerCamelCase_			):
   lowerCAmelCase__     :   Optional[int]     		=	[2_5_5, 2_5_5, 2_5_5] - img[i][j]

 return img


if __name__ == "__main__":
     # read original image
     snake_case									=    imread("""image_data/lena.jpg""", 1)

     # convert to its negative
     snake_case									=    convert_to_negative(img)

     # show result image
     imshow("""negative of original image""", img)
     waitKey(0)
     destroyAllWindows()





