


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


class        _a							(			nn.Module			):
							_lowercase	:			int
							_lowercase	:			jnp.dtype        = jnp.floataa

							def       lowerCamelCase_ (							self:	str							)			->   Tuple:





									"""simple docstring"""







									lowercase__            =      nn.Conv(
									    self.out_channels    ,						kernel_size=(3, 3)    ,						strides=(1, 1)    ,						padding=((1, 1), (1, 1))    ,						dtype=self.dtype    ,						)


							def __call__(							self:	Dict    ,						UpperCamelCase_:	int							)			->   List[str]:





									"""simple docstring"""







									lowercase__     ,		lowercase__     ,		lowercase__     ,		lowercase__            =      hidden_states.shape
									lowercase__            =      jax.image.resize(
									    UpperCamelCase_    ,						shape=(batch, height * 2, width * 2, channels)    ,						method='''nearest'''    ,						)
									lowercase__            =      self.conv(UpperCamelCase_							)
									return hidden_states


class        _a							(			nn.Module			):
							_lowercase	:			int
							_lowercase	:			jnp.dtype        = jnp.floataa

							def       lowerCamelCase_ (							self:	Tuple							)			->   Dict:





									"""simple docstring"""







									lowercase__            =      nn.Conv(
									    self.out_channels    ,						kernel_size=(3, 3)    ,						strides=(2, 2)    ,						padding=((1, 1), (1, 1))    ,						dtype=self.dtype    ,						)


							def __call__(							self:	Optional[int]    ,						UpperCamelCase_:	Optional[Any]							)			->   Union[str, Any]:





									"""simple docstring"""







									lowercase__            =      self.conv(UpperCamelCase_							)
									return hidden_states


class        _a							(			nn.Module			):
							_lowercase	:			int
							_lowercase	:			int        = None
							_lowercase	:			float        = 0.0
							_lowercase	:			bool        = None
							_lowercase	:			jnp.dtype        = jnp.floataa

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





									"""simple docstring"""







									lowercase__            =      self.in_channels if self.out_channels is None else self.out_channels

									lowercase__            =      nn.GroupNorm(num_groups=32    ,						epsilon=1E-5							)
									lowercase__            =      nn.Conv(
									    UpperCamelCase_    ,						kernel_size=(3, 3)    ,						strides=(1, 1)    ,						padding=((1, 1), (1, 1))    ,						dtype=self.dtype    ,						)

									lowercase__            =      nn.Dense(UpperCamelCase_    ,						dtype=self.dtype							)

									lowercase__            =      nn.GroupNorm(num_groups=32    ,						epsilon=1E-5							)
									lowercase__            =      nn.Dropout(self.dropout_prob							)
									lowercase__            =      nn.Conv(
									    UpperCamelCase_    ,						kernel_size=(3, 3)    ,						strides=(1, 1)    ,						padding=((1, 1), (1, 1))    ,						dtype=self.dtype    ,						)

									lowercase__            =      self.in_channels != out_channels if self.use_nin_shortcut is None else self.use_nin_shortcut

									lowercase__            =      None
									if use_nin_shortcut:
											lowercase__            =      nn.Conv(
											    UpperCamelCase_    ,						kernel_size=(1, 1)    ,						strides=(1, 1)    ,						padding='''VALID'''    ,						dtype=self.dtype    ,						)


							def __call__(							self:	Optional[Any]    ,						UpperCamelCase_:	Tuple    ,						UpperCamelCase_:	List[str]    ,						UpperCamelCase_:	str=True							)			->   Tuple:





									"""simple docstring"""







									lowercase__            =      hidden_states
									lowercase__            =      self.norma(UpperCamelCase_							)
									lowercase__            =      nn.swish(UpperCamelCase_							)
									lowercase__            =      self.conva(UpperCamelCase_							)

									lowercase__            =      self.time_emb_proj(nn.swish(UpperCamelCase_							)							)
									lowercase__            =      jnp.expand_dims(jnp.expand_dims(UpperCamelCase_    ,						1							)    ,						1							)
									lowercase__            =      hidden_states + temb

									lowercase__            =      self.norma(UpperCamelCase_							)
									lowercase__            =      nn.swish(UpperCamelCase_							)
									lowercase__            =      self.dropout(UpperCamelCase_    ,						UpperCamelCase_							)
									lowercase__            =      self.conva(UpperCamelCase_							)

									if self.conv_shortcut is not None:
											lowercase__            =      self.conv_shortcut(UpperCamelCase_							)

									return hidden_states + residual






def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		return credit_card_number.startswith(('''34''', '''35''', '''37''', '''4''', '''5''', '''6''')     )
def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      credit_card_number
		lowercase__            =      0
		lowercase__            =      len(SCREAMING_SNAKE_CASE     ) - 2
		for i in range(SCREAMING_SNAKE_CASE						,				-1						,				-2     ):
				#  double the value of every second digit
				lowercase__            =      int(cc_number[i]     )
				digit *= 2
				# If doubling of a number results in a two digit number
				# i.e greater than 9(e.g., 6 × 2 = 12),
				# then add the digits of the product (e.g., 12: 1 + 2 = 3, 15: 1 + 5 = 6),
				# to get a single digit number.
				if digit > 9:
						digit %= 10
						digit += 1
				lowercase__            =      cc_number[:i] + str(SCREAMING_SNAKE_CASE     ) + cc_number[i + 1 :]
				total += digit

		# Sum up the remaining digits
		for i in range(len(SCREAMING_SNAKE_CASE     ) - 1						,				-1						,				-2     ):
				total += int(cc_number[i]     )

		return total % 10 == 0
def 			_a (      SCREAMING_SNAKE_CASE     ):


		"""simple docstring"""




		lowercase__            =      f'{credit_card_number} is an invalid credit card number because'
		if not credit_card_number.isdigit():
				print(f'{error_message} it has nonnumerical characters.'     )
				return False

		if not 13 <= len(SCREAMING_SNAKE_CASE     ) <= 16:
				print(f'{error_message} of its length.'     )
				return False

		if not validate_initial_digits(SCREAMING_SNAKE_CASE     ):
				print(f'{error_message} of its first two digits.'     )
				return False

		if not luhn_validation(SCREAMING_SNAKE_CASE     ):
				print(f'{error_message} it fails the Luhn check.'     )
				return False

		print(f'{credit_card_number} is a valid credit card number.'     )
		return True


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			validate_credit_card_number('4111111111111111')
			validate_credit_card_number('32323')


