__snake_case						=			tuple[float, float, float]
__snake_case						=			tuple[float, float, float]





def      lowerCAmelCase_       ( __lowerCAmelCase						,    __lowerCAmelCase  )->     Vectorad:






      '''simple docstring'''





      UpperCAmelCase			:       int			     =end_pointa[0] - end_pointa[0]
      UpperCAmelCase			:       str			     =end_pointa[1] - end_pointa[1]
      UpperCAmelCase			:       str			     =end_pointa[2] - end_pointa[2]
      return (x, y, z)





def      lowerCAmelCase_       ( __lowerCAmelCase						,    __lowerCAmelCase  )->     Vectorad:






      '''simple docstring'''





      UpperCAmelCase			:       List[Any]			     =ab[1] * ac[2] - ab[2] * ac[1]  # *i
      UpperCAmelCase			:       Tuple			     =(ab[0] * ac[2] - ab[2] * ac[0]) * -1  # *j
      UpperCAmelCase			:       List[str]			     =ab[0] * ac[1] - ab[1] * ac[0]  # *k
      return (x, y, z)





def      lowerCAmelCase_       ( __lowerCAmelCase						,    __lowerCAmelCase  )->     bool:






      '''simple docstring'''





      return tuple(round(__lowerCAmelCase						,    __lowerCAmelCase  ) for x in vector  ) == (0, 0, 0)





def      lowerCAmelCase_       ( __lowerCAmelCase						,    __lowerCAmelCase						,    __lowerCAmelCase						,    __lowerCAmelCase = 10  )->     bool:






      '''simple docstring'''





      UpperCAmelCase			:       Dict			     =create_vector(__lowerCAmelCase						,    __lowerCAmelCase  )
      UpperCAmelCase			:       Optional[Any]			     =create_vector(__lowerCAmelCase						,    __lowerCAmelCase  )
      return is_zero_vector(get_ad_vectors_cross(__lowerCAmelCase						,    __lowerCAmelCase  )						,    __lowerCAmelCase  )








from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import MagicMock, patch

from transformers import AutoModel, TFAutoModel
from transformers.onnx import FeaturesManager
from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch






@require_torch
@require_tf
class 		lowercase_					(	lowercase   ):






      '''simple docstring'''




      def       __lowerCAmelCase					(      self      :						str  )    ->int:




       """simple docstring"""


       a		  =      SMALL_MODEL_IDENTIFIER
       a		  =      '''pt'''
       a		  =      '''tf'''







      def       __lowerCAmelCase					(      self      :						Optional[Any] ,					__UpperCAmelCase      :						str  )    ->Union[str, Any]:




       """simple docstring"""


       a		  =      AutoModel.from_pretrained(self.test_model  )
       model_pt.save_pretrained(__UpperCAmelCase  )







      def       __lowerCAmelCase					(      self      :						Any ,					__UpperCAmelCase      :						Union[str, Any]  )    ->List[str]:




       """simple docstring"""


       a		  =      TFAutoModel.from_pretrained(self.test_model ,					from_pt=__UpperCAmelCase  )
       model_tf.save_pretrained(__UpperCAmelCase  )







      def       __lowerCAmelCase					(      self      :						Any  )    ->int:




       """simple docstring"""


       a		  =      '''mock_framework'''

       # Framework provided - return whatever the user provides
       a		  =      FeaturesManager.determine_framework(self.test_model ,					__UpperCAmelCase  )
       self.assertEqual(__UpperCAmelCase ,					__UpperCAmelCase  )

       # Local checkpoint and framework provided - return provided framework
       # PyTorch checkpoint
       with TemporaryDirectory() as local_pt_ckpt:
        self._setup_pt_ckpt(__UpperCAmelCase  )
        a		  =      FeaturesManager.determine_framework(__UpperCAmelCase ,					__UpperCAmelCase  )
        self.assertEqual(__UpperCAmelCase ,					__UpperCAmelCase  )

       # TensorFlow checkpoint
       with TemporaryDirectory() as local_tf_ckpt:
        self._setup_tf_ckpt(__UpperCAmelCase  )
        a		  =      FeaturesManager.determine_framework(__UpperCAmelCase ,					__UpperCAmelCase  )
        self.assertEqual(__UpperCAmelCase ,					__UpperCAmelCase  )







      def       __lowerCAmelCase					(      self      :						str  )    ->int:




       """simple docstring"""


       with TemporaryDirectory() as local_pt_ckpt:
        self._setup_pt_ckpt(__UpperCAmelCase  )
        a		  =      FeaturesManager.determine_framework(__UpperCAmelCase  )
        self.assertEqual(__UpperCAmelCase ,					self.framework_pt  )

       # TensorFlow checkpoint
       with TemporaryDirectory() as local_tf_ckpt:
        self._setup_tf_ckpt(__UpperCAmelCase  )
        a		  =      FeaturesManager.determine_framework(__UpperCAmelCase  )
        self.assertEqual(__UpperCAmelCase ,					self.framework_tf  )

       # Invalid local checkpoint
       with TemporaryDirectory() as local_invalid_ckpt:
        with self.assertRaises(__UpperCAmelCase  ):
         a		  =      FeaturesManager.determine_framework(__UpperCAmelCase  )







      def       __lowerCAmelCase					(      self      :						Optional[int]  )    ->List[str]:




       """simple docstring"""


       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       with patch('''transformers.onnx.features.is_tf_available''' ,					__UpperCAmelCase  ):
        a		  =      FeaturesManager.determine_framework(self.test_model  )
        self.assertEqual(__UpperCAmelCase ,					self.framework_pt  )

       # PyTorch not in environment -> use TensorFlow
       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       with patch('''transformers.onnx.features.is_torch_available''' ,					__UpperCAmelCase  ):
        a		  =      FeaturesManager.determine_framework(self.test_model  )
        self.assertEqual(__UpperCAmelCase ,					self.framework_tf  )

       # Both in environment -> use PyTorch
       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       with patch('''transformers.onnx.features.is_tf_available''' ,					__UpperCAmelCase  ), patch(
           '''transformers.onnx.features.is_torch_available''' ,					__UpperCAmelCase  ):
        a		  =      FeaturesManager.determine_framework(self.test_model  )
        self.assertEqual(__UpperCAmelCase ,					self.framework_pt  )

       # Both not in environment -> raise error
       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       a		  =      MagicMock(return_value=__UpperCAmelCase  )
       with patch('''transformers.onnx.features.is_tf_available''' ,					__UpperCAmelCase  ), patch(
           '''transformers.onnx.features.is_torch_available''' ,					__UpperCAmelCase  ):
        with self.assertRaises(__UpperCAmelCase  ):
         a		  =      FeaturesManager.determine_framework(self.test_model  )


