






"""simple docstring"""







import unittest

import numpy as np
import torch

from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad







class        _SCREAMING_SNAKE_CASE						(  unittest.TestCase							):





							"""simple docstring"""





							def  lowercase		(   self:     Optional[Any]    ):

												'''simple docstring'''

												a__          =  10




							def  lowercase		(   self:     Tuple    ):

												'''simple docstring'''

												a__          =  [1, 2, 3, 4]
												a__          =  [1, 2, 3, 4, 0, 0, 0, 0, 0, 0]
												self.assertEqual(truncate_or_pad(__A				,		self.block_size				,		0    )				,		__A    )




							def  lowercase		(   self:     int    ):

												'''simple docstring'''

												a__          =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
												a__          =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
												self.assertEqual(truncate_or_pad(__A				,		self.block_size				,		0    )				,		__A    )




							def  lowercase		(   self:     Optional[Any]    ):

												'''simple docstring'''

												a__          =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
												a__          =  [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
												self.assertEqual(truncate_or_pad(__A				,		self.block_size				,		0    )				,		__A    )




							def  lowercase		(   self:     List[str]    ):

												'''simple docstring'''

												a__          =  '''It was the year of Our Lord one thousand seven hundred and
        seventy-five.\n\nSpiritual revelations were conceded to England at that
        favoured period, as at this.'''
												a__       ,a__          =  process_story(__A    )
												self.assertEqual(__A				,		[]    )




							def  lowercase		(   self:     Optional[int]    ):

												'''simple docstring'''

												a__          =  ''''''
												a__       ,a__          =  process_story(__A    )
												self.assertEqual(__A				,		[]    )
												self.assertEqual(__A				,		[]    )




							def  lowercase		(   self:     Union[str, Any]    ):

												'''simple docstring'''

												a__          =  (
												    '''It was the year of Our Lord one thousand seven hundred and '''
												    '''seventy-five\n\nSpiritual revelations were conceded to England '''
												    '''at that favoured period, as at this.\n@highlight\n\nIt was the best of times'''
												)
												a__       ,a__          =  process_story(__A    )

												a__          =  [
												    '''It was the year of Our Lord one thousand seven hundred and seventy-five.''',
												    '''Spiritual revelations were conceded to England at that favoured period, as at this.''',
												]
												self.assertEqual(__A				,		__A    )

												a__          =  ['''It was the best of times.''']
												self.assertEqual(__A				,		__A    )




							def  lowercase		(   self:     Optional[Any]    ):

												'''simple docstring'''

												a__          =  torch.tensor([1, 2, 3, 4]    )
												a__          =  torch.tensor([1, 1, 1, 1]    )
												np.testing.assert_array_equal(build_mask(__A				,		0    ).numpy()				,		expected.numpy()    )




							def  lowercase		(   self:     List[str]    ):

												'''simple docstring'''

												a__          =  torch.tensor([1, 2, 3, 4, 23, 23, 23]    )
												a__          =  torch.tensor([1, 1, 1, 1, 0, 0, 0]    )
												np.testing.assert_array_equal(build_mask(__A				,		23    ).numpy()				,		expected.numpy()    )




							def  lowercase		(   self:     List[Any]    ):

												'''simple docstring'''

												a__          =  torch.tensor([8, 2, 3, 4, 1, 1, 1]    )
												a__          =  torch.tensor([1, 1, 1, 1, 0, 0, 0]    )
												np.testing.assert_array_equal(build_mask(__A				,		1    ).numpy()				,		expected.numpy()    )





							def  lowercase		(   self:     List[Any]    ):

												'''simple docstring'''

												a__          =  101
												a__          =  torch.tensor([[1, 2, 3, 4, 5, 6], [1, 2, 3, 101, 5, 6], [1, 101, 3, 4, 101, 6]]    )
												a__          =  torch.tensor([[1, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0], [1, 0, 0, 0, 1, 1]]    )

												a__          =  compute_token_type_ids(__A				,		__A    )
												np.testing.assert_array_equal(__A				,		__A    )










"""simple docstring"""







from typing import TYPE_CHECKING

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


__a       :	str             = {
    'configuration_swiftformer': [
        'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SwiftFormerConfig',
        'SwiftFormerOnnxConfig',
    ]
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__a       :	int             = [
	    'SWIFTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'SwiftFormerForImageClassification',
	    'SwiftFormerModel',
	    'SwiftFormerPreTrainedModel',
	]

if TYPE_CHECKING:
	from .configuration_swiftformer import (
	    SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
	    SwiftFormerConfig,
	    SwiftFormerOnnxConfig,
	)

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_swiftformer import (
		    SWIFTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    SwiftFormerForImageClassification,
		    SwiftFormerModel,
		    SwiftFormerPreTrainedModel,
		)

else:
	import sys

	__a       :	Dict             = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)


