
"""simple docstring"""





import os
import unittest

from transformers import BertTokenizerFast
from transformers.models.bert.tokenization_bert import (
    VOCAB_FILES_NAMES,
    BasicTokenizer,
    BertTokenizer,
    WordpieceTokenizer,
    _is_control,
    _is_punctuation,
    _is_whitespace,
)
from transformers.testing_utils import require_tokenizers, slow

from ...test_tokenization_common import TokenizerTesterMixin, filter_non_english






@require_tokenizers
class        _UpperCAmelCase(       __snake_case ,	unittest.TestCase      ):
		lowercase__         = BertTokenizer
		lowercase__         = BertTokenizerFast
		lowercase__         = True
		lowercase__         = True
		lowercase__         = filter_non_english



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							super().setUp()

							_UpperCamelCase									=    [
							    '''[UNK]''',
							    '''[CLS]''',
							    '''[SEP]''',
							    '''[PAD]''',
							    '''[MASK]''',
							    '''want''',
							    '''##want''',
							    '''##ed''',
							    '''wa''',
							    '''un''',
							    '''runn''',
							    '''##ing''',
							    ''',''',
							    '''low''',
							    '''lowest''',
							]
							_UpperCamelCase									=    os.path.join(self.tmpdirname							,						VOCAB_FILES_NAMES['''vocab_file'''])
							with open(self.vocab_file							,						'''w'''							,						encoding='''utf-8''') as vocab_writer:
												vocab_writer.write(''''''.join([x + '''\n''' for x in vocab_tokens]))



		def 		UpperCAmelCase				(   self							,						__a)			->			List[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    '''UNwant\u00E9d,running'''
							_UpperCamelCase									=    '''unwanted, running'''
							return input_text, output_text



		def 		UpperCAmelCase				(   self)			->			int:






							'''simple docstring'''
							_UpperCamelCase									=    self.tokenizer_class(self.vocab_file)

							_UpperCamelCase									=    tokenizer.tokenize('''UNwant\u00E9d,running''')
							self.assertListEqual(A__							,						['''un''', '''##want''', '''##ed''', ''',''', '''runn''', '''##ing'''])
							self.assertListEqual(tokenizer.convert_tokens_to_ids(A__)							,						[9, 6, 7, 12, 10, 11])



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							if not self.test_rust_tokenizer:
												return

							_UpperCamelCase									=    self.get_tokenizer()
							_UpperCamelCase									=    self.get_rust_tokenizer()

							_UpperCamelCase									=    '''UNwant\u00E9d,running'''

							_UpperCamelCase									=    tokenizer.tokenize(A__)
							_UpperCamelCase									=    rust_tokenizer.tokenize(A__)
							self.assertListEqual(A__							,						A__)

							_UpperCamelCase									=    tokenizer.encode(A__							,						add_special_tokens=A__)
							_UpperCamelCase									=    rust_tokenizer.encode(A__							,						add_special_tokens=A__)
							self.assertListEqual(A__							,						A__)

							_UpperCamelCase									=    self.get_rust_tokenizer()
							_UpperCamelCase									=    tokenizer.encode(A__)
							_UpperCamelCase									=    rust_tokenizer.encode(A__)
							self.assertListEqual(A__							,						A__)

							# With lower casing
							_UpperCamelCase									=    self.get_tokenizer(do_lower_case=A__)
							_UpperCamelCase									=    self.get_rust_tokenizer(do_lower_case=A__)

							_UpperCamelCase									=    '''UNwant\u00E9d,running'''

							_UpperCamelCase									=    tokenizer.tokenize(A__)
							_UpperCamelCase									=    rust_tokenizer.tokenize(A__)
							self.assertListEqual(A__							,						A__)

							_UpperCamelCase									=    tokenizer.encode(A__							,						add_special_tokens=A__)
							_UpperCamelCase									=    rust_tokenizer.encode(A__							,						add_special_tokens=A__)
							self.assertListEqual(A__							,						A__)

							_UpperCamelCase									=    self.get_rust_tokenizer()
							_UpperCamelCase									=    tokenizer.encode(A__)
							_UpperCamelCase									=    rust_tokenizer.encode(A__)
							self.assertListEqual(A__							,						A__)



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer()

							self.assertListEqual(tokenizer.tokenize('''ah\u535A\u63A8zz''')							,						['''ah''', '''\u535A''', '''\u63A8''', '''zz'''])



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU?  ''')							,						['''hello''', '''!''', '''how''', '''are''', '''you''', '''?'''])
							self.assertListEqual(tokenizer.tokenize('''H\u00E9llo''')							,						['''hello'''])



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__							,						strip_accents=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  ''')							,						['''hällo''', '''!''', '''how''', '''are''', '''you''', '''?'''])
							self.assertListEqual(tokenizer.tokenize('''H\u00E9llo''')							,						['''h\u00E9llo'''])



		def 		UpperCAmelCase				(   self)			->			str:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__							,						strip_accents=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  ''')							,						['''hallo''', '''!''', '''how''', '''are''', '''you''', '''?'''])
							self.assertListEqual(tokenizer.tokenize('''H\u00E9llo''')							,						['''hello'''])



		def 		UpperCAmelCase				(   self)			->			Union[str, Any]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  ''')							,						['''hallo''', '''!''', '''how''', '''are''', '''you''', '''?'''])
							self.assertListEqual(tokenizer.tokenize('''H\u00E9llo''')							,						['''hello'''])



		def 		UpperCAmelCase				(   self)			->			Tuple:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU?  ''')							,						['''HeLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?'''])



		def 		UpperCAmelCase				(   self)			->			int:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__							,						strip_accents=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  ''')							,						['''HäLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?'''])



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__							,						strip_accents=A__)

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHäLLo!how  \n Are yoU?  ''')							,						['''HaLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?'''])



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer(do_lower_case=A__							,						never_split=['''[UNK]'''])

							self.assertListEqual(
							    tokenizer.tokenize(''' \tHeLLo!how  \n Are yoU? [UNK]''')							,						['''HeLLo''', '''!''', '''how''', '''Are''', '''yoU''', '''?''', '''[UNK]'''])



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							_UpperCamelCase									=    BasicTokenizer()
							_UpperCamelCase									=    '''a\n\'ll !!to?\'d of, can\'t.'''
							_UpperCamelCase									=    ['''a''', '''\'''', '''ll''', '''!''', '''!''', '''to''', '''?''', '''\'''', '''d''', '''of''', ''',''', '''can''', '''\'''', '''t''', '''.''']
							self.assertListEqual(tokenizer.tokenize(A__)							,						A__)



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							_UpperCamelCase									=    ['''[UNK]''', '''[CLS]''', '''[SEP]''', '''want''', '''##want''', '''##ed''', '''wa''', '''un''', '''runn''', '''##ing''']

							_UpperCamelCase									=    {}
							for i, token in enumerate(A__):
												_UpperCamelCase									=    i
							_UpperCamelCase									=    WordpieceTokenizer(vocab=A__							,						unk_token='''[UNK]''')

							self.assertListEqual(tokenizer.tokenize('''''')							,						[])

							self.assertListEqual(tokenizer.tokenize('''unwanted running''')							,						['''un''', '''##want''', '''##ed''', '''runn''', '''##ing'''])

							self.assertListEqual(tokenizer.tokenize('''unwantedX running''')							,						['''[UNK]''', '''runn''', '''##ing'''])



		def 		UpperCAmelCase				(   self)			->			Dict:






							'''simple docstring'''
							self.assertTrue(_is_whitespace(''' '''))
							self.assertTrue(_is_whitespace('''\t'''))
							self.assertTrue(_is_whitespace('''\r'''))
							self.assertTrue(_is_whitespace('''\n'''))
							self.assertTrue(_is_whitespace('''\u00A0'''))

							self.assertFalse(_is_whitespace('''A'''))
							self.assertFalse(_is_whitespace('''-'''))



		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							self.assertTrue(_is_control('''\u0005'''))

							self.assertFalse(_is_control('''A'''))
							self.assertFalse(_is_control(''' '''))
							self.assertFalse(_is_control('''\t'''))
							self.assertFalse(_is_control('''\r'''))



		def 		UpperCAmelCase				(   self)			->			List[str]:






							'''simple docstring'''
							self.assertTrue(_is_punctuation('''-'''))
							self.assertTrue(_is_punctuation('''$'''))
							self.assertTrue(_is_punctuation('''`'''))
							self.assertTrue(_is_punctuation('''.'''))

							self.assertFalse(_is_punctuation('''A'''))
							self.assertFalse(_is_punctuation(''' '''))



		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    self.get_tokenizer()
							_UpperCamelCase									=    self.get_rust_tokenizer()

							# Example taken from the issue https://github.com/huggingface/tokenizers/issues/340
							self.assertListEqual([tokenizer.tokenize(A__) for t in ['''Test''', '''\xad''', '''test''']]							,						[['''[UNK]'''], [], ['''[UNK]''']])

							self.assertListEqual(
							    [rust_tokenizer.tokenize(A__) for t in ['''Test''', '''\xad''', '''test''']]							,						[['''[UNK]'''], [], ['''[UNK]''']])



		@slow
		def 		UpperCAmelCase				(   self)			->			Optional[int]:






							'''simple docstring'''
							_UpperCamelCase									=    self.tokenizer_class.from_pretrained('''bert-base-uncased''')

							_UpperCamelCase									=    tokenizer.encode('''sequence builders'''							,						add_special_tokens=A__)
							_UpperCamelCase									=    tokenizer.encode('''multi-sequence build'''							,						add_special_tokens=A__)

							_UpperCamelCase									=    tokenizer.build_inputs_with_special_tokens(A__)
							_UpperCamelCase									=    tokenizer.build_inputs_with_special_tokens(A__							,						A__)

							assert encoded_sentence == [1_01] + text + [1_02]
							assert encoded_pair == [1_01] + text + [1_02] + text_a + [1_02]



		def 		UpperCAmelCase				(   self)			->			List[Any]:






							'''simple docstring'''
							for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
												with self.subTest(F'''{tokenizer.__class__.__name__} ({pretrained_name})'''):
																	_UpperCamelCase									=    self.rust_tokenizer_class.from_pretrained(A__							,						**A__)

																	_UpperCamelCase									=    F'''A, naïve {tokenizer_r.mask_token} AllenNLP sentence.'''
																	_UpperCamelCase									=    tokenizer_r.encode_plus(
																	    A__							,						return_attention_mask=A__							,						return_token_type_ids=A__							,						return_offsets_mapping=A__							,						add_special_tokens=A__							,						)

																	_UpperCamelCase									=    tokenizer_r.do_lower_case if hasattr(A__							,						'''do_lower_case''') else False
																	_UpperCamelCase									=    (
																	    [
																	        ((0, 0), tokenizer_r.cls_token),
																	        ((0, 1), '''A'''),
																	        ((1, 2), ''','''),
																	        ((3, 5), '''na'''),
																	        ((5, 6), '''##ï'''),
																	        ((6, 8), '''##ve'''),
																	        ((9, 15), tokenizer_r.mask_token),
																	        ((16, 21), '''Allen'''),
																	        ((21, 23), '''##NL'''),
																	        ((23, 24), '''##P'''),
																	        ((25, 33), '''sentence'''),
																	        ((33, 34), '''.'''),
																	        ((0, 0), tokenizer_r.sep_token),
																	    ]
																	    if not do_lower_case
																	    else [
																	        ((0, 0), tokenizer_r.cls_token),
																	        ((0, 1), '''a'''),
																	        ((1, 2), ''','''),
																	        ((3, 8), '''naive'''),
																	        ((9, 15), tokenizer_r.mask_token),
																	        ((16, 21), '''allen'''),
																	        ((21, 23), '''##nl'''),
																	        ((23, 24), '''##p'''),
																	        ((25, 33), '''sentence'''),
																	        ((33, 34), '''.'''),
																	        ((0, 0), tokenizer_r.sep_token),
																	    ]
																	)

																	self.assertEqual(
																	    [e[1] for e in expected_results]							,						tokenizer_r.convert_ids_to_tokens(tokens['''input_ids''']))
																	self.assertEqual([e[0] for e in expected_results]							,						tokens['''offset_mapping'''])




		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






							'''simple docstring'''
							_UpperCamelCase									=    ['''的''', '''人''', '''有''']
							_UpperCamelCase									=    ''''''.join(A__)
							for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
												with self.subTest(F'''{tokenizer.__class__.__name__} ({pretrained_name})'''):
																	_UpperCamelCase									=    True
																	_UpperCamelCase									=    self.tokenizer_class.from_pretrained(A__							,						**A__)
																	_UpperCamelCase									=    self.rust_tokenizer_class.from_pretrained(A__							,						**A__)

																	_UpperCamelCase									=    tokenizer_p.encode(A__							,						add_special_tokens=A__)
																	_UpperCamelCase									=    tokenizer_r.encode(A__							,						add_special_tokens=A__)

																	_UpperCamelCase									=    tokenizer_r.convert_ids_to_tokens(A__)
																	_UpperCamelCase									=    tokenizer_p.convert_ids_to_tokens(A__)

																	# it is expected that each Chinese character is not preceded by "##"
																	self.assertListEqual(A__							,						A__)
																	self.assertListEqual(A__							,						A__)

																	_UpperCamelCase									=    False
																	_UpperCamelCase									=    self.rust_tokenizer_class.from_pretrained(A__							,						**A__)
																	_UpperCamelCase									=    self.tokenizer_class.from_pretrained(A__							,						**A__)

																	_UpperCamelCase									=    tokenizer_r.encode(A__							,						add_special_tokens=A__)
																	_UpperCamelCase									=    tokenizer_p.encode(A__							,						add_special_tokens=A__)

																	_UpperCamelCase									=    tokenizer_r.convert_ids_to_tokens(A__)
																	_UpperCamelCase									=    tokenizer_p.convert_ids_to_tokens(A__)

																	# it is expected that only the first Chinese character is not preceded by "##".
																	_UpperCamelCase									=    [
																	    F'''##{token}''' if idx != 0 else token for idx, token in enumerate(A__)
																	]
																	self.assertListEqual(A__							,						A__)
																	self.assertListEqual(A__							,						A__)














import flax.linen as nn
import jax.numpy as jnp

from .attention_flax import FlaxTransformeraDModel
from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD






class 						UpperCAmelCase__ (							nn.Module							):
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       float     =   0.0
		__snake_case      :       int     =   1
		__snake_case      :       int     =   1
		__snake_case      :       bool     =   True
		__snake_case      :       bool     =   False
		__snake_case      :       bool     =   False
		__snake_case      :       bool     =   False
		__snake_case      :       jnp.dtype     =   jnp.floataa







		def  A__      (					self		):
						_A	:				Optional[Any]   =      []
						_A	:				str   =      []

						for i in range(self.num_layers		):
										_A	:				Union[str, Any]   =      self.in_channels if i == 0 else self.out_channels

										_A	:				str   =      FlaxResnetBlockaD(
										    in_channels=A__       ,out_channels=self.out_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
										resnets.append(A__		)

										_A	:				List[str]   =      FlaxTransformeraDModel(
										    in_channels=self.out_channels       ,n_heads=self.num_attention_heads       ,d_head=self.out_channels // self.num_attention_heads       ,depth=1       ,use_linear_projection=self.use_linear_projection       ,only_cross_attention=self.only_cross_attention       ,use_memory_efficient_attention=self.use_memory_efficient_attention       ,dtype=self.dtype       ,)
										attentions.append(A__		)

						_A	:				List[str]   =      resnets
						_A	:				Any   =      attentions

						if self.add_downsample:
										_A	:				Any   =      FlaxDownsampleaD(self.out_channels       ,dtype=self.dtype		)







		def __call__(					self       ,A__       ,A__       ,A__       ,A__=True		):
						_A	:				List[str]   =      ()

						for resnet, attn in zip(self.resnets       ,self.attentions		):
										_A	:				Optional[Any]   =      resnet(A__       ,A__       ,deterministic=A__		)
										_A	:				Tuple   =      attn(A__       ,A__       ,deterministic=A__		)
										output_states += (hidden_states,)

						if self.add_downsample:
										_A	:				Optional[int]   =      self.downsamplers_a(A__		)
										output_states += (hidden_states,)

						return hidden_states, output_states






class 						UpperCAmelCase__ (							nn.Module							):
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       float     =   0.0
		__snake_case      :       int     =   1
		__snake_case      :       bool     =   True
		__snake_case      :       jnp.dtype     =   jnp.floataa







		def  A__      (					self		):
						_A	:				List[Any]   =      []

						for i in range(self.num_layers		):
										_A	:				int   =      self.in_channels if i == 0 else self.out_channels

										_A	:				List[Any]   =      FlaxResnetBlockaD(
										    in_channels=A__       ,out_channels=self.out_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
										resnets.append(A__		)
						_A	:				Tuple   =      resnets

						if self.add_downsample:
										_A	:				Optional[Any]   =      FlaxDownsampleaD(self.out_channels       ,dtype=self.dtype		)







		def __call__(					self       ,A__       ,A__       ,A__=True		):
						_A	:				List[Any]   =      ()

						for resnet in self.resnets:
										_A	:				Optional[int]   =      resnet(A__       ,A__       ,deterministic=A__		)
										output_states += (hidden_states,)

						if self.add_downsample:
										_A	:				List[Any]   =      self.downsamplers_a(A__		)
										output_states += (hidden_states,)

						return hidden_states, output_states






class 						UpperCAmelCase__ (							nn.Module							):
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       float     =   0.0
		__snake_case      :       int     =   1
		__snake_case      :       int     =   1
		__snake_case      :       bool     =   True
		__snake_case      :       bool     =   False
		__snake_case      :       bool     =   False
		__snake_case      :       bool     =   False
		__snake_case      :       jnp.dtype     =   jnp.floataa







		def  A__      (					self		):
						_A	:				List[str]   =      []
						_A	:				Optional[Any]   =      []

						for i in range(self.num_layers		):
										_A	:				Dict   =      self.in_channels if (i == self.num_layers - 1) else self.out_channels
										_A	:				List[str]   =      self.prev_output_channel if i == 0 else self.out_channels

										_A	:				Optional[int]   =      FlaxResnetBlockaD(
										    in_channels=resnet_in_channels + res_skip_channels       ,out_channels=self.out_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
										resnets.append(A__		)

										_A	:				Union[str, Any]   =      FlaxTransformeraDModel(
										    in_channels=self.out_channels       ,n_heads=self.num_attention_heads       ,d_head=self.out_channels // self.num_attention_heads       ,depth=1       ,use_linear_projection=self.use_linear_projection       ,only_cross_attention=self.only_cross_attention       ,use_memory_efficient_attention=self.use_memory_efficient_attention       ,dtype=self.dtype       ,)
										attentions.append(A__		)

						_A	:				Dict   =      resnets
						_A	:				int   =      attentions

						if self.add_upsample:
										_A	:				str   =      FlaxUpsampleaD(self.out_channels       ,dtype=self.dtype		)







		def __call__(					self       ,A__       ,A__       ,A__       ,A__       ,A__=True		):
						for resnet, attn in zip(self.resnets       ,self.attentions		):
										# pop res hidden states
										_A	:				List[Any]   =      res_hidden_states_tuple[-1]
										_A	:				int   =      res_hidden_states_tuple[:-1]
										_A	:				List[Any]   =      jnp.concatenate((hidden_states, res_hidden_states)       ,axis=-1		)

										_A	:				str   =      resnet(A__       ,A__       ,deterministic=A__		)
										_A	:				Optional[int]   =      attn(A__       ,A__       ,deterministic=A__		)

						if self.add_upsample:
										_A	:				Union[str, Any]   =      self.upsamplers_a(A__		)

						return hidden_states






class 						UpperCAmelCase__ (							nn.Module							):
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       int
		__snake_case      :       float     =   0.0
		__snake_case      :       int     =   1
		__snake_case      :       bool     =   True
		__snake_case      :       jnp.dtype     =   jnp.floataa







		def  A__      (					self		):
						_A	:				Optional[Any]   =      []

						for i in range(self.num_layers		):
										_A	:				Any   =      self.in_channels if (i == self.num_layers - 1) else self.out_channels
										_A	:				Optional[Any]   =      self.prev_output_channel if i == 0 else self.out_channels

										_A	:				List[Any]   =      FlaxResnetBlockaD(
										    in_channels=resnet_in_channels + res_skip_channels       ,out_channels=self.out_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
										resnets.append(A__		)

						_A	:				int   =      resnets

						if self.add_upsample:
										_A	:				List[str]   =      FlaxUpsampleaD(self.out_channels       ,dtype=self.dtype		)







		def __call__(					self       ,A__       ,A__       ,A__       ,A__=True		):
						for resnet in self.resnets:
										# pop res hidden states
										_A	:				Tuple   =      res_hidden_states_tuple[-1]
										_A	:				Optional[int]   =      res_hidden_states_tuple[:-1]
										_A	:				Any   =      jnp.concatenate((hidden_states, res_hidden_states)       ,axis=-1		)

										_A	:				Optional[Any]   =      resnet(A__       ,A__       ,deterministic=A__		)

						if self.add_upsample:
										_A	:				Tuple   =      self.upsamplers_a(A__		)

						return hidden_states






class 						UpperCAmelCase__ (							nn.Module							):
		__snake_case      :       int
		__snake_case      :       float     =   0.0
		__snake_case      :       int     =   1
		__snake_case      :       int     =   1
		__snake_case      :       bool     =   False
		__snake_case      :       bool     =   False
		__snake_case      :       jnp.dtype     =   jnp.floataa







		def  A__      (					self		):
						# there is always at least one resnet
						_A	:				List[str]   =      [
						    FlaxResnetBlockaD(
						        in_channels=self.in_channels       ,out_channels=self.in_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
						]

						_A	:				Union[str, Any]   =      []

						for _ in range(self.num_layers		):
										_A	:				Any   =      FlaxTransformeraDModel(
										    in_channels=self.in_channels       ,n_heads=self.num_attention_heads       ,d_head=self.in_channels // self.num_attention_heads       ,depth=1       ,use_linear_projection=self.use_linear_projection       ,use_memory_efficient_attention=self.use_memory_efficient_attention       ,dtype=self.dtype       ,)
										attentions.append(A__		)

										_A	:				Any   =      FlaxResnetBlockaD(
										    in_channels=self.in_channels       ,out_channels=self.in_channels       ,dropout_prob=self.dropout       ,dtype=self.dtype       ,)
										resnets.append(A__		)

						_A	:				List[str]   =      resnets
						_A	:				str   =      attentions







		def __call__(					self       ,A__       ,A__       ,A__       ,A__=True		):
						_A	:				Optional[int]   =      self.resnets[0](A__       ,A__		)
						for attn, resnet in zip(self.attentions       ,self.resnets[1:]		):
										_A	:				Dict   =      attn(A__       ,A__       ,deterministic=A__		)
										_A	:				Any   =      resnet(A__       ,A__       ,deterministic=A__		)

						return hidden_states



