



'''simple docstring'''






import logging

# standard libraries
import sys

import numpy as np
import pytest  # type: ignore

# Custom/local libraries
from matrix import matrix_operation as matop

A_				:					Any							=      [[1_2, 1_0], [3, 9]]
A_				:					Tuple							=      [[3, 4], [7, 4]]
A_				:					List[str]							=      [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
A_				:					Union[str, Any]							=      [[3, 0, -2], [2, 0, 2], [0, 1, 1]]
A_				:					Optional[int]							=      [[3, 0, 2], [2, 0, -2], [0, 1, 1], [2, 0, -2]]
A_				:					Tuple							=      [1]
A_				:					List[Any]							=      [2]

A_				:					Dict							=      logging.getLogger()
A_				:					Optional[int]							=      logging.DEBUG
A_				:					List[Any]							=      logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler)




@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("""mat1""", """mat2""")			,  [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]						)
def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_						)->						str:





       '''simple docstring'''


       if (np.array(lowerCAmelCase_						)).shape < (2, 2) or (np.array(lowerCAmelCase_						)).shape < (2, 2):
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(F'''\n\t{test_addition.__name__} returned integer'''						)
                     matop.add(lowerCAmelCase_			,  lowerCAmelCase_						)
       elif (np.array(lowerCAmelCase_						)).shape == (np.array(lowerCAmelCase_						)).shape:
              logger.info(F'''\n\t{test_addition.__name__} with same matrix dims'''						)
              _UpperCAmelCase    :		int     	=					(np.array(lowerCAmelCase_						) + np.array(lowerCAmelCase_						)).tolist()
              _UpperCAmelCase    :		int     	=					matop.add(lowerCAmelCase_			,  lowerCAmelCase_						)
              assert theo == act
       else:
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(F'''\n\t{test_addition.__name__} with different matrix dims'''						)
                     matop.add(lowerCAmelCase_			,  lowerCAmelCase_						)




@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("""mat1""", """mat2""")			,  [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]						)
def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_						)->						Optional[Any]:





       '''simple docstring'''


       if (np.array(lowerCAmelCase_						)).shape < (2, 2) or (np.array(lowerCAmelCase_						)).shape < (2, 2):
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(F'''\n\t{test_subtraction.__name__} returned integer'''						)
                     matop.subtract(lowerCAmelCase_			,  lowerCAmelCase_						)
       elif (np.array(lowerCAmelCase_						)).shape == (np.array(lowerCAmelCase_						)).shape:
              logger.info(F'''\n\t{test_subtraction.__name__} with same matrix dims'''						)
              _UpperCAmelCase    :		Tuple     	=					(np.array(lowerCAmelCase_						) - np.array(lowerCAmelCase_						)).tolist()
              _UpperCAmelCase    :		int     	=					matop.subtract(lowerCAmelCase_			,  lowerCAmelCase_						)
              assert theo == act
       else:
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(F'''\n\t{test_subtraction.__name__} with different matrix dims'''						)
                     assert matop.subtract(lowerCAmelCase_			,  lowerCAmelCase_						)




@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ("""mat1""", """mat2""")			,  [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]						)
def        snake_case_   (	lowerCAmelCase_			,  lowerCAmelCase_						)->						List[Any]:





       '''simple docstring'''


       if (np.array(lowerCAmelCase_						)).shape < (2, 2) or (np.array(lowerCAmelCase_						)).shape < (2, 2):
              logger.info(F'''\n\t{test_multiplication.__name__} returned integer'''						)
              with pytest.raises(lowerCAmelCase_						):
                     matop.add(lowerCAmelCase_			,  lowerCAmelCase_						)
       elif (np.array(lowerCAmelCase_						)).shape == (np.array(lowerCAmelCase_						)).shape:
              logger.info(F'''\n\t{test_multiplication.__name__} meets dim requirements'''						)
              _UpperCAmelCase    :		str     	=					(np.matmul(lowerCAmelCase_			,  lowerCAmelCase_						)).tolist()
              _UpperCAmelCase    :		Union[str, Any]     	=					matop.multiply(lowerCAmelCase_			,  lowerCAmelCase_						)
              assert theo == act
       else:
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(
                         F'''\n\t{test_multiplication.__name__} does not meet dim requirements'''						)
                     assert matop.subtract(lowerCAmelCase_			,  lowerCAmelCase_						)




@pytest.mark.mat_ops
def        snake_case_   (	)->						Optional[Any]:





       '''simple docstring'''


       _UpperCAmelCase    :		Optional[Any]     	=					(3.5 * np.array(lowerCAmelCase_						)).tolist()
       _UpperCAmelCase    :		List[Any]     	=					matop.scalar_multiply(lowerCAmelCase_			,  3.5						)
       assert theo == act




@pytest.mark.mat_ops
def        snake_case_   (	)->						Optional[Any]:





       '''simple docstring'''


       _UpperCAmelCase    :		Dict     	=					(np.identity(5						)).tolist()
       _UpperCAmelCase    :		Union[str, Any]     	=					matop.identity(5						)
       assert theo == act




@pytest.mark.mat_ops
@pytest.mark.parametrize("""mat"""			,  [mat_a, mat_b, mat_c, mat_d, mat_e, mat_f]						)
def        snake_case_   (	lowerCAmelCase_						)->						List[Any]:





       '''simple docstring'''


       if (np.array(lowerCAmelCase_						)).shape < (2, 2):
              with pytest.raises(lowerCAmelCase_						):
                     logger.info(F'''\n\t{test_transpose.__name__} returned integer'''						)
                     matop.transpose(lowerCAmelCase_						)
       else:
              _UpperCAmelCase    :		str     	=					(np.transpose(lowerCAmelCase_						)).tolist()
              _UpperCAmelCase    :		List[str]     	=					matop.transpose(lowerCAmelCase_			,  return_map=lowerCAmelCase_						)
              assert theo == act







# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
    is_vision_available,
)


__lowerCamelCase   	=  {
    '''configuration_tvlt''': ['''TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TvltConfig'''],
    '''feature_extraction_tvlt''': ['''TvltFeatureExtractor'''],
    '''processing_tvlt''': ['''TvltProcessor'''],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCamelCase   	=  [
           '''TVLT_PRETRAINED_MODEL_ARCHIVE_LIST''',
           '''TvltModel''',
           '''TvltForPreTraining''',
           '''TvltForAudioVisualClassification''',
           '''TvltPreTrainedModel''',
       ]

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCamelCase   	=  ['''TvltImageProcessor''']


if TYPE_CHECKING:
       from .configuration_tvlt import TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP, TvltConfig
       from .processing_tvlt import TvltProcessor
       from .feature_extraction_tvlt import TvltFeatureExtractor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tvlt import (
                  TVLT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TvltForAudioVisualClassification,
                  TvltForPreTraining,
                  TvltModel,
                  TvltPreTrainedModel,
              )

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .image_processing_tvlt import TvltImageProcessor


else:
       import sys

       __lowerCamelCase   	=  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



