






from typing import Optional, Tuple, Union

import tensorflow as tf

from ...activations_tf import ACTaFN
from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward
from ...modeling_tf_outputs import (
    TFBaseModelOutputWithNoAttention,
    TFBaseModelOutputWithPoolingAndNoAttention,
    TFSequenceClassifierOutput,
)
from ...modeling_tf_utils import TFPreTrainedModel, TFSequenceClassificationLoss, keras_serializable, unpack_inputs
from ...tf_utils import shape_list
from ...utils import logging
from .configuration_regnet import RegNetConfig


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

# General docstring
__a      :       Dict				  =   "RegNetConfig"

# Base docstring
__a      :       Optional[Any]				  =   "facebook/regnet-y-040"
__a      :       Any				  =   [1, 1088, 7, 7]

# Image classification docstring
__a      :       List[Any]				  =   "facebook/regnet-y-040"
__a      :       str				  =   "tabby, tabby cat"

__a      :       List[str]				  =   [
    "facebook/regnet-y-040",
    # See all regnet models at https://huggingface.co/models?filter=regnet
]


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			Dict ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int = 3 ,	UpperCamelCase_       :			int = 1 ,	UpperCamelCase_       :			int = 1 ,	UpperCamelCase_       :			Optional[str] = "relu" ,	**UpperCamelCase_       :			List[Any] ,	):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         # The padding and conv has been verified in
         # https://colab.research.google.com/gist/sayakpaul/854bc10eeaf21c9ee2119e0b9f3841a7/scratchpad.ipynb
         __A         =	tf.keras.layers.ZeroPaddingaD(padding=kernel_size // 2				)
         __A         =	tf.keras.layers.ConvaD(
             filters=UpperCamelCase_ ,	kernel_size=UpperCamelCase_ ,	strides=UpperCamelCase_ ,	padding="""VALID""" ,	groups=UpperCamelCase_ ,	use_bias=UpperCamelCase_ ,	name="""convolution""" ,	)
         __A         =	tf.keras.layers.BatchNormalization(epsilon=1e-5 ,	momentum=0.9 ,	name="""normalization"""				)
         __A         =	ACTaFN[activation] if activation is not None else tf.identity





     def 		lowerCAmelCase_     (				self       :			Dict ,	UpperCamelCase_       :			Union[str, Any]				):


         """simple docstring"""



         __A         =	self.convolution(self.padding(UpperCamelCase_				)				)
         __A         =	self.normalization(UpperCamelCase_				)
         __A         =	self.activation(UpperCamelCase_				)
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			Optional[int] ,	UpperCamelCase_       :			RegNetConfig ,	**UpperCamelCase_       :			Tuple				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	config.num_channels
         __A         =	TFRegNetConvLayer(
             out_channels=config.embedding_size ,	kernel_size=3 ,	stride=2 ,	activation=config.hidden_act ,	name="""embedder""" ,	)





     def 		lowerCAmelCase_     (				self       :			int ,	UpperCamelCase_       :			List[Any]				):


         """simple docstring"""



         __A         =	shape_list(UpperCamelCase_				)[1]
         if tf.executing_eagerly() and num_channels != self.num_channels:
             raise ValueError(
                 """Make sure that the channel dimension of the pixel values match with the one set in the configuration."""				)

         # When running on CPU, `tf.keras.layers.Conv2D` doesn't support `NCHW` format.
         # So change the input format from `NCHW` to `NHWC`.
         # shape = (batch_size, in_height, in_width, in_channels=num_channels)
         __A         =	tf.transpose(UpperCamelCase_ ,	perm=(0, 2, 3, 1)				)
         __A         =	self.embedder(UpperCamelCase_				)
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			Tuple ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int = 2 ,	**UpperCamelCase_       :			Optional[int]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	tf.keras.layers.ConvaD(
             filters=UpperCamelCase_ ,	kernel_size=1 ,	strides=UpperCamelCase_ ,	use_bias=UpperCamelCase_ ,	name="""convolution"""				)
         __A         =	tf.keras.layers.BatchNormalization(epsilon=1e-5 ,	momentum=0.9 ,	name="""normalization"""				)





     def 		lowerCAmelCase_     (				self       :			Union[str, Any] ,	UpperCamelCase_       :			tf.Tensor ,	UpperCamelCase_       :			bool = False				):


         """simple docstring"""



         return self.normalization(self.convolution(UpperCamelCase_				) ,	training=UpperCamelCase_				)


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			str ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int ,	**UpperCamelCase_       :			List[str]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	tf.keras.layers.GlobalAveragePoolingaD(keepdims=UpperCamelCase_ ,	name="""pooler"""				)
         __A         =	[
             tf.keras.layers.ConvaD(filters=UpperCamelCase_ ,	kernel_size=1 ,	activation="""relu""" ,	name="""attention.0"""				),
             tf.keras.layers.ConvaD(filters=UpperCamelCase_ ,	kernel_size=1 ,	activation="""sigmoid""" ,	name="""attention.2"""				),
         ]





     def 		lowerCAmelCase_     (				self       :			Optional[Any] ,	UpperCamelCase_       :			Optional[Any]				):


         """simple docstring"""



         __A         =	self.pooler(UpperCamelCase_				)
         for layer_module in self.attention:
             __A         =	layer_module(UpperCamelCase_				)
         __A         =	hidden_state * pooled
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			Tuple ,	UpperCamelCase_       :			RegNetConfig ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int = 1 ,	**UpperCamelCase_       :			Union[str, Any]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	in_channels != out_channels or stride != 1
         __A         =	max(1 ,	out_channels // config.groups_width				)
         __A         =	(
             TFRegNetShortCut(UpperCamelCase_ ,	stride=UpperCamelCase_ ,	name="""shortcut"""				)
             if should_apply_shortcut
             else tf.keras.layers.Activation("""linear""" ,	name="""shortcut"""				)
         )
         # `self.layers` instead of `self.layer` because that is a reserved argument.
         __A         =	[
             TFRegNetConvLayer(UpperCamelCase_ ,	kernel_size=1 ,	activation=config.hidden_act ,	name="""layer.0"""				),
             TFRegNetConvLayer(
                 UpperCamelCase_ ,	stride=UpperCamelCase_ ,	groups=UpperCamelCase_ ,	activation=config.hidden_act ,	name="""layer.1"""				),
             TFRegNetConvLayer(UpperCamelCase_ ,	kernel_size=1 ,	activation=UpperCamelCase_ ,	name="""layer.2"""				),
         ]
         __A         =	ACTaFN[config.hidden_act]





     def 		lowerCAmelCase_     (				self       :			Union[str, Any] ,	UpperCamelCase_       :			str				):


         """simple docstring"""



         __A         =	hidden_state
         for layer_module in self.layers:
             __A         =	layer_module(UpperCamelCase_				)
         __A         =	self.shortcut(UpperCamelCase_				)
         hidden_state += residual
         __A         =	self.activation(UpperCamelCase_				)
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			List[Any] ,	UpperCamelCase_       :			RegNetConfig ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int = 1 ,	**UpperCamelCase_       :			Optional[int]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	in_channels != out_channels or stride != 1
         __A         =	max(1 ,	out_channels // config.groups_width				)
         __A         =	(
             TFRegNetShortCut(UpperCamelCase_ ,	stride=UpperCamelCase_ ,	name="""shortcut"""				)
             if should_apply_shortcut
             else tf.keras.layers.Activation("""linear""" ,	name="""shortcut"""				)
         )
         __A         =	[
             TFRegNetConvLayer(UpperCamelCase_ ,	kernel_size=1 ,	activation=config.hidden_act ,	name="""layer.0"""				),
             TFRegNetConvLayer(
                 UpperCamelCase_ ,	stride=UpperCamelCase_ ,	groups=UpperCamelCase_ ,	activation=config.hidden_act ,	name="""layer.1"""				),
             TFRegNetSELayer(UpperCamelCase_ ,	reduced_channels=int(round(in_channels / 4				)				) ,	name="""layer.2"""				),
             TFRegNetConvLayer(UpperCamelCase_ ,	kernel_size=1 ,	activation=UpperCamelCase_ ,	name="""layer.3"""				),
         ]
         __A         =	ACTaFN[config.hidden_act]





     def 		lowerCAmelCase_     (				self       :			Tuple ,	UpperCamelCase_       :			List[Any]				):


         """simple docstring"""



         __A         =	hidden_state
         for layer_module in self.layers:
             __A         =	layer_module(UpperCamelCase_				)
         __A         =	self.shortcut(UpperCamelCase_				)
         hidden_state += residual
         __A         =	self.activation(UpperCamelCase_				)
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			List[Any] ,	UpperCamelCase_       :			RegNetConfig ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int ,	UpperCamelCase_       :			int = 2 ,	UpperCamelCase_       :			int = 2 ,	**UpperCamelCase_       :			Optional[int]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)

         __A         =	TFRegNetXLayer if config.layer_type == """x""" else TFRegNetYLayer
         __A         =	[
             # downsampling is done in the first layer with stride of 2
             layer(UpperCamelCase_ ,	UpperCamelCase_ ,	UpperCamelCase_ ,	stride=UpperCamelCase_ ,	name="""layers.0"""				),
             *[layer(UpperCamelCase_ ,	UpperCamelCase_ ,	UpperCamelCase_ ,	name=F"layers.{i+1}"				) for i in range(depth - 1				)],
         ]





     def 		lowerCAmelCase_     (				self       :			Union[str, Any] ,	UpperCamelCase_       :			Optional[Any]				):


         """simple docstring"""



         for layer_module in self.layers:
             __A         =	layer_module(UpperCamelCase_				)
         return hidden_state


class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''




     def __init__(				self       :			str ,	UpperCamelCase_       :			RegNetConfig ,	**UpperCamelCase_       :			Union[str, Any]				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	[]
         # based on `downsample_in_first_stage`, the first layer of the first stage may or may not downsample the input
         self.stages.append(
             TFRegNetStage(
                 UpperCamelCase_ ,	config.embedding_size ,	config.hidden_sizes[0] ,	stride=2 if config.downsample_in_first_stage else 1 ,	depth=config.depths[0] ,	name="""stages.0""" ,	)				)
         __A         =	zip(config.hidden_sizes ,	config.hidden_sizes[1:]				)
         for i, ((in_channels, out_channels), depth) in enumerate(zip(UpperCamelCase_ ,	config.depths[1:]				)				):
             self.stages.append(TFRegNetStage(UpperCamelCase_ ,	UpperCamelCase_ ,	UpperCamelCase_ ,	depth=UpperCamelCase_ ,	name=F"stages.{i+1}"				)				)





     def 		lowerCAmelCase_     (				self       :			Tuple ,	UpperCamelCase_       :			tf.Tensor ,	UpperCamelCase_       :			bool = False ,	UpperCamelCase_       :			bool = True				):


         """simple docstring"""



         __A         =	() if output_hidden_states else None

         for stage_module in self.stages:
             if output_hidden_states:
                 __A         =	hidden_states + (hidden_state,)

             __A         =	stage_module(UpperCamelCase_				)

         if output_hidden_states:
             __A         =	hidden_states + (hidden_state,)

         if not return_dict:
             return tuple(v for v in [hidden_state, hidden_states] if v is not None				)

         return TFBaseModelOutputWithNoAttention(last_hidden_state=UpperCamelCase_ ,	hidden_states=UpperCamelCase_				)


@keras_serializable
class       __lowercase      (	tf.keras.layers.Layer  ):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE   						=				RegNetConfig




     def __init__(				self       :			Tuple ,	UpperCamelCase_       :			List[str] ,	**UpperCamelCase_       :			Dict				):


         """simple docstring"""



         super().__init__(**UpperCamelCase_				)
         __A         =	config
         __A         =	TFRegNetEmbeddings(UpperCamelCase_ ,	name="""embedder"""				)
         __A         =	TFRegNetEncoder(UpperCamelCase_ ,	name="""encoder"""				)
         __A         =	tf.keras.layers.GlobalAveragePoolingaD(keepdims=UpperCamelCase_ ,	name="""pooler"""				)





     @unpack_inputs
     def 		lowerCAmelCase_     (				self       :			str ,	UpperCamelCase_       :			tf.Tensor ,	UpperCamelCase_       :			Optional[bool] = None ,	UpperCamelCase_       :			Optional[bool] = None ,	UpperCamelCase_       :			bool = False ,	):


         """simple docstring"""



         __A         =	(
             output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
         )
         __A         =	return_dict if return_dict is not None else self.config.use_return_dict

         __A         =	self.embedder(UpperCamelCase_ ,	training=UpperCamelCase_				)

         __A         =	self.encoder(
             UpperCamelCase_ ,	output_hidden_states=UpperCamelCase_ ,	return_dict=UpperCamelCase_ ,	training=UpperCamelCase_				)

         __A         =	encoder_outputs[0]
         __A         =	self.pooler(UpperCamelCase_				)

         # Change to NCHW output format have uniformity in the modules
         __A         =	tf.transpose(UpperCamelCase_ ,	perm=(0, 3, 1, 2)				)
         __A         =	tf.transpose(UpperCamelCase_ ,	perm=(0, 3, 1, 2)				)

         # Change the other hidden state outputs to NCHW as well
         if output_hidden_states:
             __A         =	tuple([tf.transpose(UpperCamelCase_ ,	perm=(0, 3, 1, 2)				) for h in encoder_outputs[1]]				)

         if not return_dict:
             return (last_hidden_state, pooled_output) + encoder_outputs[1:]

         return TFBaseModelOutputWithPoolingAndNoAttention(
             last_hidden_state=UpperCamelCase_ ,	pooler_output=UpperCamelCase_ ,	hidden_states=hidden_states if output_hidden_states else encoder_outputs.hidden_states ,	)


class       __lowercase      (	lowercase_  ):







     '''simple docstring'''
     SCREAMING_SNAKE_CASE   						=				RegNetConfig
     SCREAMING_SNAKE_CASE   						=				"regnet"
     SCREAMING_SNAKE_CASE   						=				"pixel_values"




     @property
     def 		lowerCAmelCase_     (				self       :			Any				):


         """simple docstring"""



         return {"pixel_values": tf.TensorSpec(shape=(None, self.config.num_channels, 224, 224) ,	dtype=tf.floataa				)}
__a      :       List[str]				  =   R"\n    Parameters:\n    This model is a Tensorflow\n    [tf.keras.layers.Layer](https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer) sub-class. Use it as a\n    regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and\n    behavior.\n        config ([`RegNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~TFPreTrainedModel.from_pretrained`] method to load the model weights.\n"

__a      :       Tuple				  =   R"\n    Args:\n        pixel_values (`tf.Tensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See\n            [`ConveNextImageProcessor.__call__`] for details.\n        output_hidden_states (`bool`, *optional*):\n            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for\n            more detail.\n        return_dict (`bool`, *optional*):\n            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.\n"


@add_start_docstrings(
    "The bare RegNet model outputting raw features without any specific head on top."			,      lowercase_			,      )
class       __lowercase      (	lowercase_  ):







     '''simple docstring'''




     def __init__(				self       :			Any ,	UpperCamelCase_       :			RegNetConfig ,	*UpperCamelCase_       :			List[str] ,	**UpperCamelCase_       :			List[Any]				):


         """simple docstring"""



         super().__init__(UpperCamelCase_ ,	*UpperCamelCase_ ,	**UpperCamelCase_				)
         __A         =	TFRegNetMainLayer(UpperCamelCase_ ,	name="""regnet"""				)





     @unpack_inputs
     @add_start_docstrings_to_model_forward(UpperCamelCase_				)
     @add_code_sample_docstrings(
         checkpoint=_CHECKPOINT_FOR_DOC ,	output_type=UpperCamelCase_ ,	config_class=_CONFIG_FOR_DOC ,	modality="""vision""" ,	expected_output=_EXPECTED_OUTPUT_SHAPE ,	)
     def 		lowerCAmelCase_     (				self       :			Any ,	UpperCamelCase_       :			tf.Tensor ,	UpperCamelCase_       :			Optional[bool] = None ,	UpperCamelCase_       :			Optional[bool] = None ,	UpperCamelCase_       :			int=False ,	):


         """simple docstring"""



         __A         =	(
             output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
         )
         __A         =	return_dict if return_dict is not None else self.config.use_return_dict

         __A         =	self.regnet(
             pixel_values=UpperCamelCase_ ,	output_hidden_states=UpperCamelCase_ ,	return_dict=UpperCamelCase_ ,	training=UpperCamelCase_ ,	)
         if not return_dict:
             return (outputs[0],) + outputs[1:]

         return TFBaseModelOutputWithPoolingAndNoAttention(
             last_hidden_state=outputs.last_hidden_state ,	pooler_output=outputs.pooler_output ,	hidden_states=outputs.hidden_states ,	)


@add_start_docstrings(
    "\n    RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    "			,      lowercase_			,      )
class       __lowercase      (	lowercase_			,      lowercase_  ):







     '''simple docstring'''




     def __init__(				self       :			Any ,	UpperCamelCase_       :			RegNetConfig ,	*UpperCamelCase_       :			List[str] ,	**UpperCamelCase_       :			int				):


         """simple docstring"""



         super().__init__(UpperCamelCase_ ,	*UpperCamelCase_ ,	**UpperCamelCase_				)
         __A         =	config.num_labels
         __A         =	TFRegNetMainLayer(UpperCamelCase_ ,	name="""regnet"""				)
         # classification head
         __A         =	[
             tf.keras.layers.Flatten(),
             tf.keras.layers.Dense(config.num_labels ,	name="""classifier.1"""				) if config.num_labels > 0 else tf.identity,
         ]





     @unpack_inputs
     @add_start_docstrings_to_model_forward(UpperCamelCase_				)
     @add_code_sample_docstrings(
         checkpoint=_IMAGE_CLASS_CHECKPOINT ,	output_type=UpperCamelCase_ ,	config_class=_CONFIG_FOR_DOC ,	expected_output=_IMAGE_CLASS_EXPECTED_OUTPUT ,	)
     def 		lowerCAmelCase_     (				self       :			Optional[Any] ,	UpperCamelCase_       :			tf.Tensor = None ,	UpperCamelCase_       :			tf.Tensor = None ,	UpperCamelCase_       :			bool = None ,	UpperCamelCase_       :			bool = None ,	UpperCamelCase_       :			List[str]=False ,	):


         """simple docstring"""



         __A         =	(
             output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
         )
         __A         =	return_dict if return_dict is not None else self.config.use_return_dict

         __A         =	self.regnet(
             UpperCamelCase_ ,	output_hidden_states=UpperCamelCase_ ,	return_dict=UpperCamelCase_ ,	training=UpperCamelCase_				)

         __A         =	outputs.pooler_output if return_dict else outputs[1]

         __A         =	self.classifier[0](UpperCamelCase_				)
         __A         =	self.classifier[1](UpperCamelCase_				)

         __A         =	None if labels is None else self.hf_compute_loss(labels=UpperCamelCase_ ,	logits=UpperCamelCase_				)

         if not return_dict:
             __A         =	(logits,) + outputs[2:]
             return ((loss,) + output) if loss is not None else output

         return TFSequenceClassifierOutput(loss=UpperCamelCase_ ,	logits=UpperCamelCase_ ,	hidden_states=outputs.hidden_states				)












import random
import sys

import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap

__a      :       List[Any]				  =   "Usage of script: script_name <size_of_canvas:int>"

__a      :       Dict				  =   [0] * 100 + [1] * 10
random.shuffle(choice)



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			int    )						->      list[list[bool]]:





    """simple docstring"""

    __A         =	[[False for i in range(__lowercase    )] for j in range(__lowercase    )]
    return canvas



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			list[list[bool]]    )						->      None:





    """simple docstring"""

    for i, row in enumerate(__lowercase    ):
        for j, _ in enumerate(__lowercase    ):
            __A         =	bool(random.getrandbits(1    )    )



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			list[list[bool]]    )						->      list[list[bool]]:





    """simple docstring"""

    __A         =	np.array(__lowercase    )
    __A         =	np.array(create_canvas(current_canvas.shape[0]    )    )
    for r, row in enumerate(__lowercase    ):
        for c, pt in enumerate(__lowercase    ):
            __A         =	__judge_point(
                __lowercase			,				current_canvas[r - 1 : r + 2, c - 1 : c + 2]    )

    __A         =	next_gen_canvas
    del next_gen_canvas  # cleaning memory as we move on.
    __A         =	current_canvas.tolist()
    return return_canvas



def 			_SCREAMING_SNAKE_CASE						( __lowercase   :			bool			,				__lowercase   :			list[list[bool]]    )						->      bool:





    """simple docstring"""

    __A         =	0
    __A         =	0
    # finding dead or alive neighbours count.
    for i in neighbours:
        for status in i:
            if status:
                alive += 1
            else:
                dead += 1

    # handling duplicate entry for focus pt.
    if pt:
        alive -= 1
    else:
        dead -= 1

    # running the rules of game here.
    __A         =	pt
    if pt:
        if alive < 2:
            __A         =	False
        elif alive == 2 or alive == 3:
            __A         =	True
        elif alive > 3:
            __A         =	False
    else:
        if alive == 3:
            __A         =	True

    return state


if __name__ == "__main__":
  if len(sys.argv) != 2:
    raise Exception(usage_doc)

  __a      :       str				  =   int(sys.argv[1])
  # main working structure of this module.
  __a      :       List[Any]				  =   create_canvas(canvas_size)
  seed(c)
  __a  ,__a      :       int				  =   plt.subplots()
  fig.show()
  __a      :       Union[str, Any]				  =   ListedColormap(["w", "k"])
  try:
    while True:
      __a      :       Dict				  =   run(c)
      ax.matshow(c, cmap=cmap)
      fig.canvas.draw()
      ax.cla()
  except KeyboardInterrupt:
    # do nothing.
    pass




