


'''simple docstring'''
from typing import Optional, Union

import torch
from torch import nn

from ...configuration_utils import ConfigMixin, register_to_config
from ...models.modeling_utils import ModelMixin

class 						_lowerCamelCase					(    __lowerCAmelCase    ,		__lowerCAmelCase				):




	'''simple docstring'''


	@register_to_config
	def __init__(      self      ,      __lowercase = 768      ,      ):

		"""simple docstring"""







		super().__init__()

		__A  :		Optional[int]       =			nn.Parameter(torch.zeros(1      ,      _UpperCamelCase						)						)
		__A  :		int       =			nn.Parameter(torch.ones(1      ,      _UpperCamelCase						)						)


	def  snake_case__   (      self      ,      __lowercase = None      ,      __lowercase = None      ,      ):

		"""simple docstring"""







		__A  :		int       =			nn.Parameter(self.mean.to(_UpperCamelCase						).to(_UpperCamelCase						)						)
		__A  :		Optional[Any]       =			nn.Parameter(self.std.to(_UpperCamelCase						).to(_UpperCamelCase						)						)
		return self


	def  snake_case__   (      self      ,      __lowercase						):

		"""simple docstring"""







		__A  :		Optional[Any]       =			(embeds - self.mean) * 1.0 / self.std
		return embeds







	def  snake_case__   (      self      ,      __lowercase						):

		"""simple docstring"""







		__A  :		Any       =			(embeds * self.std) + self.mean
		return embeds










'''simple docstring'''
import unittest

from transformers import DonutProcessor


UpperCAmelCase_ :     str								=      'naver-clova-ix/donut-base'

class 						_lowerCamelCase					(    unittest.TestCase				):




 '''simple docstring'''


 def  snake_case__   (      self						):

  """simple docstring"""







  __A  :		List[str]       =			DonutProcessor.from_pretrained(__lowercase						)







 def  snake_case__   (      self						):

  """simple docstring"""







  __A  :		List[str]       =			{
      'name': 'John Doe',
      'age': '99',
      'city': 'Atlanta',
      'state': 'GA',
      'zip': '30301',
      'phone': '123-4567',
      'nicknames': [{'nickname': 'Johnny'}, {'nickname': 'JD'}],
  }

  __A  :		Optional[Any]       =			(
      '<s_name>John Doe</s_name><s_age>99</s_age><s_city>Atlanta</s_city>'
      '<s_state>GA</s_state><s_zip>30301</s_zip><s_phone>123-4567</s_phone>'
      '<s_nicknames><s_nickname>Johnny</s_nickname>'
      '<sep/><s_nickname>JD</s_nickname></s_nicknames>'
  )
  __A  :		List[Any]       =			self.processor.tokenajson(__lowercase						)

  self.assertDictEqual(__lowercase      ,      __lowercase						)






