






'''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 _lowercase			(       __lowercase       ,   __lowercase	):




							@register_to_config
							def __init__(							self:       int    ,							UpperCamelCase__:       int = 768    ,							):
														super().__init__()

														lowerCamelCase__      :			Any 						= nn.Parameter(torch.zeros(1    ,							UpperCamelCase__  )  )
														lowerCamelCase__      :			List[str] 						= nn.Parameter(torch.ones(1    ,							UpperCamelCase__  )  )




							def 	lowerCamelCase_       (							self:       Any    ,							UpperCamelCase__:       Optional[Union[str, torch.device]] = None    ,							UpperCamelCase__:       Optional[torch.dtype] = None    ,							):
														lowerCamelCase__      :			List[Any] 						= nn.Parameter(self.mean.to(UpperCamelCase__  ).to(UpperCamelCase__  )  )
														lowerCamelCase__      :			List[str] 						= nn.Parameter(self.std.to(UpperCamelCase__  ).to(UpperCamelCase__  )  )
														return self




							def 	lowerCamelCase_       (							self:       List[str]    ,							UpperCamelCase__:       Tuple  ):
														lowerCamelCase__      :			Optional[Any] 						= (embeds - self.mean) * 1.0 / self.std
														return embeds




							def 	lowerCamelCase_       (							self:       List[str]    ,							UpperCamelCase__:       List[Any]  ):
														lowerCamelCase__      :			Dict 						= (embeds * self.std) + self.mean
														return embeds







'''simple docstring'''







from ...utils import is_torch_available, is_transformers_available


if is_transformers_available() and is_torch_available():
			from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline

