
import colorsys

from PIL import Image  # type: ignore
def 				a__   (   a   :				float       ,     a   :				float       ,     a   :				int		):

  """simple docstring"""







  _snake_case     :						Any						=   x
  _snake_case     :						int						=   y
  for step in range(a		):  # noqa: B007
    _snake_case     :						str						=   a * a - b * b + x
    _snake_case     :						Tuple						=   2 * a * b + y
    _snake_case     :						List[Any]						=   a_new

    # divergence happens for all complex number with an absolute value
    # greater than 4
    if a * a + b * b > 4:
      break
  return step / (max_step - 1)
def 				a__   (   a   :				float		):

  """simple docstring"""







  if distance == 1:
    return (0, 0, 0)
  else:
    return (255, 255, 255)
def 				a__   (   a   :				float		):

  """simple docstring"""







  if distance == 1:
    return (0, 0, 0)
  else:
    return tuple(round(i * 255		) for i in colorsys.hsv_to_rgb(a       ,     1       ,     1		)		)
def 				a__   (   a   :				int = 800       ,     a   :				int = 600       ,     a   :				float = -0.6       ,     a   :				float = 0       ,     a   :				float = 3.2       ,     a   :				int = 50       ,     a   :				bool = True       ,     ):

  """simple docstring"""







  _snake_case     :						Any						=   Image.new("RGB"       ,     (image_width, image_height)		)
  _snake_case     :						str						=   img.load()

  # loop through the image-coordinates
  for image_x in range(a		):
    for image_y in range(a		):
      # determine the figure-coordinates based on the image-coordinates
      _snake_case     :						str						=   figure_width / image_width * image_height
      _snake_case     :						Dict						=   figure_center_x + (image_x / image_width - 0.5) * figure_width
      _snake_case     :						Union[str, Any]						=   figure_center_y + (image_y / image_height - 0.5) * figure_height

      _snake_case     :						List[str]						=   get_distance(a       ,     a       ,     a		)

      # color the corresponding pixel based on the selected coloring-function
      if use_distance_color_coding:
        _snake_case     :						Tuple						=   get_color_coded_rgb(a		)
      else:
        _snake_case     :						List[str]						=   get_black_and_white_rgb(a		)

  return img


if __name__ == "__main__":
    import doctest

    doctest.testmod()

    # colored version, full figure
    _a      :			Optional[Any]					=							get_image()

    # uncomment for colored version, different section, zoomed in
    # img = get_image(figure_center_x = -0.6, figure_center_y = -0.4,
    # figure_width = 0.8)

    # uncomment for black and white version, full figure
    # img = get_image(use_distance_color_coding = False)

    # uncomment to save the image
    # img.save("mandelbrot.png")

    img.show()



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_a      :			Optional[int]					=							logging.get_logger(__name__)

_a      :			List[str]					=							{
    """facebook/convnextv2-tiny-1k-224""": """https://huggingface.co/facebook/convnextv2-tiny-1k-224/resolve/main/config.json""",
}






class      _UpperCAmelCase				(					_snake_case		,					_snake_case):
    __lowercase							: List[Any]  =					"""convnextv2"""
    def __init__(    self						,    snake_case_=3						,    snake_case_=4						,    snake_case_=4						,    snake_case_=None						,    snake_case_=None						,    snake_case_="gelu"						,    snake_case_=0.02						,    snake_case_=1E-12						,    snake_case_=0.0						,    snake_case_=2_24						,    snake_case_=None						,    snake_case_=None						,    **snake_case_						,    ):
      super().__init__(**snake_case_     )

      _snake_case     :						Tuple						=   num_channels
      _snake_case     :						Optional[int]						=   patch_size
      _snake_case     :						Tuple						=   num_stages
      _snake_case     :						int						=   [96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
      _snake_case     :						str						=   [3, 3, 9, 3] if depths is None else depths
      _snake_case     :						int						=   hidden_act
      _snake_case     :						Tuple						=   initializer_range
      _snake_case     :						Union[str, Any]						=   layer_norm_eps
      _snake_case     :						Optional[int]						=   drop_path_rate
      _snake_case     :						Union[str, Any]						=   image_size
      _snake_case     :						List[Any]						=   ["stem"] + [F'stage{idx}' for idx in range(1						,    len(self.depths     ) + 1     )]
      _snake_case			,					_snake_case     :						Dict						=   get_aligned_output_features_output_indices(
          out_features=snake_case_						,    out_indices=snake_case_						,    stage_names=self.stage_names     )

