






"""simple docstring"""


from typing import List, Optional, Tuple, Union

from . import logging
from .import_utils import is_torch_available, is_torch_version


if is_torch_available():
       import torch

lowercase_								=	logging.get_logger(__name__)  # pylint: disable=invalid-name

try:
       from torch._dynamo import allow_in_graph as maybe_allow_in_graph
except (ImportError, ModuleNotFoundError):



       def    lowerCAmelCase							(       cls					):




         """simple docstring"""







         return cls



def    lowerCAmelCase							(       __UpperCamelCase						,			__UpperCamelCase = None						,			__UpperCamelCase = None						,			__UpperCamelCase = None						,			__UpperCamelCase = None						,			):




  """simple docstring"""







  __A		     =					device
  __A		     =					shape[0]

  __A		     =					layout or torch.strided
  __A		     =					device or torch.device('''cpu'''					)

  if generator is not None:
    __A		     =					generator.device.type if not isinstance(__UpperCamelCase						,			__UpperCamelCase					) else generator[0].device.type
    if gen_device_type != device.type and gen_device_type == "cpu":
      __A		     =					'''cpu'''
      if device != "mps":
        logger.info(
            f'The passed generator was created on \'cpu\' even though a tensor on {device} was expected.'
            f' Tensors will be created on \'cpu\' and then moved to {device}. Note that one can probably'
            f' slighly speed up this function by passing a generator that was created on the {device} device.'					)
    elif gen_device_type != device.type and gen_device_type == "cuda":
      raise ValueError(f'Cannot generate a {device} tensor from a generator of type {gen_device_type}.'					)

  if isinstance(__UpperCamelCase						,			__UpperCamelCase					):
    __A		     =					(1,) + shape[1:]
    __A		     =					[
        torch.randn(__UpperCamelCase						,			generator=generator[i]						,			device=__UpperCamelCase						,			dtype=__UpperCamelCase						,			layout=__UpperCamelCase					)
        for i in range(__UpperCamelCase					)
    ]
    __A		     =					torch.cat(__UpperCamelCase						,			dim=0					).to(__UpperCamelCase					)
  else:
    __A		     =					torch.randn(__UpperCamelCase						,			generator=__UpperCamelCase						,			device=__UpperCamelCase						,			dtype=__UpperCamelCase						,			layout=__UpperCamelCase					).to(__UpperCamelCase					)

  return latents





def    lowerCAmelCase							(       __UpperCamelCase					):




  """simple docstring"""







  if is_torch_version('''<'''						,			'''2.0.0'''					) or not hasattr(__UpperCamelCase						,			'''_dynamo'''					):
    return False
  return isinstance(__UpperCamelCase						,			torch._dynamo.eval_frame.OptimizedModule					)












from typing import TYPE_CHECKING

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


UpperCAmelCase_					:		int           = {
    '''configuration_unispeech_sat''': ['''UNISPEECH_SAT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''UniSpeechSatConfig'''],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	UpperCAmelCase_					:		Tuple           = [
	    '''UNISPEECH_SAT_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''UniSpeechSatForAudioFrameClassification''',
	    '''UniSpeechSatForCTC''',
	    '''UniSpeechSatForPreTraining''',
	    '''UniSpeechSatForSequenceClassification''',
	    '''UniSpeechSatForXVector''',
	    '''UniSpeechSatModel''',
	    '''UniSpeechSatPreTrainedModel''',
	]

if TYPE_CHECKING:
	from .configuration_unispeech_sat import UNISPEECH_SAT_PRETRAINED_CONFIG_ARCHIVE_MAP, UniSpeechSatConfig

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_unispeech_sat import (
		    UNISPEECH_SAT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    UniSpeechSatForAudioFrameClassification,
		    UniSpeechSatForCTC,
		    UniSpeechSatForPreTraining,
		    UniSpeechSatForSequenceClassification,
		    UniSpeechSatForXVector,
		    UniSpeechSatModel,
		    UniSpeechSatPreTrainedModel,
		)

else:
	import sys

	UpperCAmelCase_					:		str           = _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
