




'''simple docstring'''





import warnings
from collections.abc import Callable
from typing import Any

import numpy
from matplotlib import pyplot

a		:	Any       =      0.25 + 0.0J
a		:	Union[str, Any]       =      -0.4 + 0.6J
a		:	str       =      -0.1 + 0.651J
a		:	Optional[Any]       =      -2.0
a		:	Union[str, Any]       =      5_6
a		:	int       =      2.0
a		:	Any       =      6_6_6





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    return numpy.exp(snake_case_						) + c_parameter





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    return z_values * z_values + c_parameter





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_						):
    _a				:							Any							       =      numpy.linspace(-window_size   ,	snake_case_   ,	snake_case_						)
    _a				:							List[str]							       =      x.reshape((nb_pixels, 1)						)
    _a				:							int							       =      numpy.linspace(-window_size   ,	snake_case_   ,	snake_case_						)
    _a				:							str							       =      y.reshape((1, nb_pixels)						)
    return x + 1.0J * y





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_ = None   ,	):
    _a				:							Optional[Any]							       =      z_a.astype("""complex64"""						)
    for _ in range(snake_case_						):
        _a				:							Optional[Any]							       =      eval_function(snake_case_   ,	snake_case_						)
        if infinity is not None:
            numpy.nan_to_num(snake_case_   ,	copy=snake_case_   ,	nan=snake_case_						)
            _a				:							List[Any]							       =      infinity
    return z_n





def UpperCAmelCase    (       UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_   ,	UpperCAmelCase_   ,	):
    _a				:							List[str]							       =      (abs(snake_case_						)).transpose()
    _a				:							List[str]							       =      abs_z_final[::-1, :]
    pyplot.matshow(abs_z_final < escape_radius						)
    pyplot.title(F'''Julia set of ${function_label}$, $c={function_params}$'''						)
    pyplot.show()





def UpperCAmelCase    (       ):
    warnings.filterwarnings(
        """ignore"""   ,	category=snake_case_   ,	message="""overflow encountered in multiply"""						)
    warnings.filterwarnings(
        """ignore"""   ,	category=snake_case_   ,	message="""invalid value encountered in multiply"""   ,	)
    warnings.filterwarnings(
        """ignore"""   ,	category=snake_case_   ,	message="""overflow encountered in absolute"""						)
    warnings.filterwarnings(
        """ignore"""   ,	category=snake_case_   ,	message="""overflow encountered in exp"""						)


if __name__ == "__main__":
  a		:	Optional[Any]       =      prepare_grid(window_size, nb_pixels)

  ignore_overflow_warnings()  # See file header for explanations

  a		:	List[Any]       =      2_4
  a		:	Union[str, Any]       =      2 * abs(c_cauliflower) + 1
  a		:	Union[str, Any]       =      iterate_function(
      eval_quadratic_polynomial,
      c_cauliflower,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results('''z^2+c''', c_cauliflower, escape_radius, z_final)

  a		:	Dict       =      6_4
  a		:	List[Any]       =      2 * abs(c_polynomial_a) + 1
  a		:	List[Any]       =      iterate_function(
      eval_quadratic_polynomial,
      c_polynomial_a,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results('''z^2+c''', c_polynomial_a, escape_radius, z_final)

  a		:	Union[str, Any]       =      1_6_1
  a		:	Optional[Any]       =      2 * abs(c_polynomial_a) + 1
  a		:	List[str]       =      iterate_function(
      eval_quadratic_polynomial,
      c_polynomial_a,
      nb_iterations,
      z_a,
      infinity=1.1 * escape_radius,
  )
  show_results('''z^2+c''', c_polynomial_a, escape_radius, z_final)

  a		:	int       =      1_2
  a		:	int       =      1_0_0_0_0.0
  a		:	str       =      iterate_function(
      eval_exponential,
      c_exponential,
      nb_iterations,
      z_a + 2,
      infinity=1.0e10,
  )
  show_results('''e^z+c''', c_exponential, escape_radius, z_final)




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


snake_case_      :					Any				      =     {
    'configuration_imagegpt': ['IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ImageGPTConfig', 'ImageGPTOnnxConfig']
}

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	snake_case_      :					str				      =     ['ImageGPTFeatureExtractor']
	snake_case_      :					Optional[int]				      =     ['ImageGPTImageProcessor']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	snake_case_      :					List[str]				      =     [
	    'IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'ImageGPTForCausalImageModeling',
	    'ImageGPTForImageClassification',
	    'ImageGPTModel',
	    'ImageGPTPreTrainedModel',
	    'load_tf_weights_in_imagegpt',
	]


if TYPE_CHECKING:
	from .configuration_imagegpt import IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP, ImageGPTConfig, ImageGPTOnnxConfig

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_imagegpt import ImageGPTFeatureExtractor
		from .image_processing_imagegpt import ImageGPTImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_imagegpt import (
		    IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    ImageGPTForCausalImageModeling,
		    ImageGPTForImageClassification,
		    ImageGPTModel,
		    ImageGPTPreTrainedModel,
		    load_tf_weights_in_imagegpt,
		)

else:
	import sys

	snake_case_      :					Dict				      =     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
