





from typing import Optional, Union

import torch
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss

from ...activations import ACTaFN
from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...modeling_utils import PreTrainedModel
from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
from .configuration_mobilenet_va import MobileNetVaConfig


_lowerCamelCase :    str  							= logging.get_logger(__name__)


# General docstring
_lowerCamelCase :    Any  							= '''MobileNetV1Config'''

# Base docstring
_lowerCamelCase :    Tuple  							= '''google/mobilenet_v1_1.0_224'''
_lowerCamelCase :    List[Any]  							= [1, 1_0_2_4, 7, 7]

# Image classification docstring
_lowerCamelCase :    str  							= '''google/mobilenet_v1_1.0_224'''
_lowerCamelCase :    Any  							= '''tabby, tabby cat'''


_lowerCamelCase :    Union[str, Any]  							= [
    '''google/mobilenet_v1_1.0_224''',
    '''google/mobilenet_v1_0.75_192''',
    # See all MobileNetV1 models at https://huggingface.co/models?filter=mobilenet_v1
]




def _a (  SCREAMING_SNAKE_CASE__      :  List[str]			,				SCREAMING_SNAKE_CASE__      :  int			,				SCREAMING_SNAKE_CASE__      :  Union[str, Any]=None       )	->    Union[str, Any]:

							'''simple docstring'''






							SCREAMING_SNAKE_CASE__       :      Tuple     =						{}

							if isinstance(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       ):
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						model.mobilenet_va
							else:
														SCREAMING_SNAKE_CASE__       :      Dict     =						model

							SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						"MobilenetV1/Conv2d_0/"
							SCREAMING_SNAKE_CASE__       :      str     =						backbone.conv_stem.convolution.weight
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						backbone.conv_stem.normalization.bias
							SCREAMING_SNAKE_CASE__       :      Any     =						backbone.conv_stem.normalization.weight
							SCREAMING_SNAKE_CASE__       :      List[str]     =						backbone.conv_stem.normalization.running_mean
							SCREAMING_SNAKE_CASE__       :      Optional[int]     =						backbone.conv_stem.normalization.running_var

							for i in range(13       ):
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						i + 1
														SCREAMING_SNAKE_CASE__       :      Dict     =						i * 2

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						backbone.layer[pt_index]
														SCREAMING_SNAKE_CASE__       :      List[str]     =						f'''MobilenetV1/Conv2d_{tf_index}_depthwise/'''
														SCREAMING_SNAKE_CASE__       :      List[str]     =						pointer.convolution.weight
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						pointer.normalization.bias
														SCREAMING_SNAKE_CASE__       :      int     =						pointer.normalization.weight
														SCREAMING_SNAKE_CASE__       :      Tuple     =						pointer.normalization.running_mean
														SCREAMING_SNAKE_CASE__       :      Any     =						pointer.normalization.running_var

														SCREAMING_SNAKE_CASE__       :      Any     =						backbone.layer[pt_index + 1]
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						f'''MobilenetV1/Conv2d_{tf_index}_pointwise/'''
														SCREAMING_SNAKE_CASE__       :      List[str]     =						pointer.convolution.weight
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						pointer.normalization.bias
														SCREAMING_SNAKE_CASE__       :      str     =						pointer.normalization.weight
														SCREAMING_SNAKE_CASE__       :      Any     =						pointer.normalization.running_mean
														SCREAMING_SNAKE_CASE__       :      int     =						pointer.normalization.running_var

							if isinstance(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       ):
														SCREAMING_SNAKE_CASE__       :      List[str]     =						"MobilenetV1/Logits/Conv2d_1c_1x1/"
														SCREAMING_SNAKE_CASE__       :      str     =						model.classifier.weight
														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						model.classifier.bias

							return tf_to_pt_map




def _a (  SCREAMING_SNAKE_CASE__      :  str			,				SCREAMING_SNAKE_CASE__      :  Optional[Any]			,				SCREAMING_SNAKE_CASE__      :  Any       )	->    Tuple:

							'''simple docstring'''






							try:
														import numpy as np
														import tensorflow as tf
							except ImportError:
														logger.error(
														    "Loading a TensorFlow models in PyTorch, requires TensorFlow to be installed. Please see "
														    "https://www.tensorflow.org/install/ for installation instructions."       )
														raise

							# Load weights from TF model
							SCREAMING_SNAKE_CASE__       :      Optional[int]     =						tf.train.list_variables(SCREAMING_SNAKE_CASE__       )
							SCREAMING_SNAKE_CASE__       :      Dict     =						{}
							for name, shape in init_vars:
														logger.info(f'''Loading TF weight {name} with shape {shape}'''       )
														SCREAMING_SNAKE_CASE__       :      int     =						tf.train.load_variable(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )
														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						array

							# Build TF to PyTorch weights loading map
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						_build_tf_to_pytorch_map(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )

							for name, pointer in tf_to_pt_map.items():
														logger.info(f'''Importing {name}'''       )
														if name not in tf_weights:
																					logger.info(f'''{name} not in tf pre-trained weights, skipping'''       )
																					continue

														SCREAMING_SNAKE_CASE__       :      List[str]     =						tf_weights[name]

														if "depthwise_weights" in name:
																					logger.info("Transposing depthwise"       )
																					SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						np.transpose(SCREAMING_SNAKE_CASE__			,				(2, 3, 0, 1)       )
														elif "weights" in name:
																					logger.info("Transposing"       )
																					if len(pointer.shape       ) == 2:  # copying into linear layer
																												SCREAMING_SNAKE_CASE__       :      Optional[int]     =						array.squeeze().transpose()
																					else:
																												SCREAMING_SNAKE_CASE__       :      int     =						np.transpose(SCREAMING_SNAKE_CASE__			,				(3, 2, 0, 1)       )

														if pointer.shape != array.shape:
																					raise ValueError(f'''Pointer shape {pointer.shape} and array shape {array.shape} mismatched'''       )

														logger.info(f'''Initialize PyTorch weight {name} {array.shape}'''       )
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						torch.from_numpy(SCREAMING_SNAKE_CASE__       )

														tf_weights.pop(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )
														tf_weights.pop(name + "/RMSProp"			,				SCREAMING_SNAKE_CASE__       )
														tf_weights.pop(name + "/RMSProp_1"			,				SCREAMING_SNAKE_CASE__       )
														tf_weights.pop(name + "/ExponentialMovingAverage"			,				SCREAMING_SNAKE_CASE__       )

							logger.info(f'''Weights not copied to PyTorch model: {", ".join(tf_weights.keys()       )}'''       )
							return model




def _a (  SCREAMING_SNAKE_CASE__      :  torch.Tensor			,				SCREAMING_SNAKE_CASE__      :  nn.Convad       )	->    torch.Tensor:

							'''simple docstring'''






							SCREAMING_SNAKE_CASE__   ,SCREAMING_SNAKE_CASE__       :      Tuple     =						features.shape[-2:]
							SCREAMING_SNAKE_CASE__   ,SCREAMING_SNAKE_CASE__       :      Dict     =						conv_layer.stride
							SCREAMING_SNAKE_CASE__   ,SCREAMING_SNAKE_CASE__       :      List[str]     =						conv_layer.kernel_size

							if in_height % stride_height == 0:
														SCREAMING_SNAKE_CASE__       :      int     =						max(kernel_height - stride_height			,				0       )
							else:
														SCREAMING_SNAKE_CASE__       :      Dict     =						max(kernel_height - (in_height % stride_height)			,				0       )

							if in_width % stride_width == 0:
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						max(kernel_width - stride_width			,				0       )
							else:
														SCREAMING_SNAKE_CASE__       :      Any     =						max(kernel_width - (in_width % stride_width)			,				0       )

							SCREAMING_SNAKE_CASE__       :      List[Any]     =						pad_along_width // 2
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						pad_along_width - pad_left
							SCREAMING_SNAKE_CASE__       :      str     =						pad_along_height // 2
							SCREAMING_SNAKE_CASE__       :      Dict     =						pad_along_height - pad_top

							SCREAMING_SNAKE_CASE__       :      List[Any]     =						(pad_left, pad_right, pad_top, pad_bottom)
							return nn.functional.pad(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__			,				"constant"			,				0.0       )


class 						lowerCamelCase       (nn.Module      ):







							"""simple docstring"""




							def __init__( self     :					int,			_UpperCAmelCase     :					MobileNetVaConfig,			_UpperCAmelCase     :					int,			_UpperCAmelCase     :					int,			_UpperCAmelCase     :					int,			_UpperCAmelCase     :					Optional[int] = 1,			_UpperCAmelCase     :					Optional[int] = 1,			_UpperCAmelCase     :					bool = False,			_UpperCAmelCase     :					Optional[bool] = True,			_UpperCAmelCase     :					Optional[bool or str] = True,			)				->			None:





														"""simple docstring"""
														super().__init__()
														SCREAMING_SNAKE_CASE__       :      str     =						config

														if in_channels % groups != 0:
																					raise ValueError(F'''Input channels ({in_channels}) are not divisible by {groups} groups.'''						)
														if out_channels % groups != 0:
																					raise ValueError(F'''Output channels ({out_channels}) are not divisible by {groups} groups.'''						)

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						0 if config.tf_padding else int((kernel_size - 1) / 2						)

														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						nn.Convad(
														    in_channels=_UpperCAmelCase,			out_channels=_UpperCAmelCase,			kernel_size=_UpperCAmelCase,			stride=_UpperCAmelCase,			padding=_UpperCAmelCase,			groups=_UpperCAmelCase,			bias=_UpperCAmelCase,			padding_mode="zeros",			)

														if use_normalization:
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						nn.BatchNormad(
																					    num_features=_UpperCAmelCase,			eps=config.layer_norm_eps,			momentum=0.9997,			affine=_UpperCAmelCase,			track_running_stats=_UpperCAmelCase,			)
														else:
																					SCREAMING_SNAKE_CASE__       :      str     =						None

														if use_activation:
																					if isinstance(_UpperCAmelCase,			_UpperCAmelCase						):
																												SCREAMING_SNAKE_CASE__       :      Optional[int]     =						ACTaFN[use_activation]
																					elif isinstance(config.hidden_act,			_UpperCAmelCase						):
																												SCREAMING_SNAKE_CASE__       :      List[Any]     =						ACTaFN[config.hidden_act]
																					else:
																												SCREAMING_SNAKE_CASE__       :      Any     =						config.hidden_act
														else:
																					SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						None






							def  A_     ( self     :					Tuple,			_UpperCAmelCase     :					torch.Tensor						)				->			torch.Tensor:





														"""simple docstring"""
														if self.config.tf_padding:
																					SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						apply_tf_padding(_UpperCAmelCase,			self.convolution						)
														SCREAMING_SNAKE_CASE__       :      str     =						self.convolution(_UpperCAmelCase						)
														if self.normalization is not None:
																					SCREAMING_SNAKE_CASE__       :      Optional[int]     =						self.normalization(_UpperCAmelCase						)
														if self.activation is not None:
																					SCREAMING_SNAKE_CASE__       :      List[str]     =						self.activation(_UpperCAmelCase						)
														return features


class 						lowerCamelCase       (__lowerCamelCase      ):







							"""simple docstring"""




							UpperCAmelCase_      						=   MobileNetVaConfig
							UpperCAmelCase_      						=   load_tf_weights_in_mobilenet_va
							UpperCAmelCase_      						=   "mobilenet_v1"
							UpperCAmelCase_      						=   "pixel_values"
							UpperCAmelCase_      						=   False






							def  A_     ( self     :					Any,			_UpperCAmelCase     :					Union[nn.Linear, nn.Convad]						)				->			None:





														"""simple docstring"""
														if isinstance(_UpperCAmelCase,			(nn.Linear, nn.Convad)						):
																					module.weight.data.normal_(mean=0.0,			std=self.config.initializer_range						)
																					if module.bias is not None:
																												module.bias.data.zero_()
														elif isinstance(_UpperCAmelCase,			nn.BatchNormad						):
																					module.bias.data.zero_()
																					module.weight.data.fill_(1.0						)


_lowerCamelCase :    Optional[int]  							= r'''
    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass. Use it
    as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
    behavior.

    Parameters:
        config ([`MobileNetV1Config`]): Model configuration class with all the parameters of the model.
            Initializing with a config file does not load the weights associated with the model, only the
            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
'''

_lowerCamelCase :    Dict  							= r'''
    Args:
        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
            Pixel values. Pixel values can be obtained using [`AutoImageProcessor`]. See
            [`MobileNetV1ImageProcessor.__call__`] for details.
        output_hidden_states (`bool`, *optional*):
            Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
            more detail.
        return_dict (`bool`, *optional*):
            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
'''


@add_start_docstrings(
    "The bare MobileNetV1 model outputting raw hidden-states without any specific head on top."							,     __lowerCamelCase							,     )
class 						lowerCamelCase       (__lowerCamelCase      ):







							"""simple docstring"""




							def __init__( self     :					str,			_UpperCAmelCase     :					MobileNetVaConfig,			_UpperCAmelCase     :					bool = True						)				->			Tuple:





														"""simple docstring"""
														super().__init__(_UpperCAmelCase						)
														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						config

														SCREAMING_SNAKE_CASE__       :      str     =						3_2
														SCREAMING_SNAKE_CASE__       :      Tuple     =						max(int(depth * config.depth_multiplier						),			config.min_depth						)

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						MobileNetVaConvLayer(
														    _UpperCAmelCase,			in_channels=config.num_channels,			out_channels=_UpperCAmelCase,			kernel_size=3,			stride=2,			)

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						[1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1]

														SCREAMING_SNAKE_CASE__       :      List[str]     =						nn.ModuleList()
														for i in range(1_3						):
																					SCREAMING_SNAKE_CASE__       :      Dict     =						out_channels

																					if strides[i] == 2 or i == 0:
																												depth *= 2
																												SCREAMING_SNAKE_CASE__       :      Dict     =						max(int(depth * config.depth_multiplier						),			config.min_depth						)

																					self.layer.append(
																					    MobileNetVaConvLayer(
																					        _UpperCAmelCase,			in_channels=_UpperCAmelCase,			out_channels=_UpperCAmelCase,			kernel_size=3,			stride=strides[i],			groups=_UpperCAmelCase,			)						)

																					self.layer.append(
																					    MobileNetVaConvLayer(
																					        _UpperCAmelCase,			in_channels=_UpperCAmelCase,			out_channels=_UpperCAmelCase,			kernel_size=1,			)						)

														SCREAMING_SNAKE_CASE__       :      str     =						nn.AdaptiveAvgPoolad((1, 1)						) if add_pooling_layer else None

														# Initialize weights and apply final processing
														self.post_init()






							def  A_     ( self     :					List[str],			_UpperCAmelCase     :					List[str]						)				->			Union[str, Any]:





														"""simple docstring"""
														raise NotImplementedError






							@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  A_     ( self     :					str,			_UpperCAmelCase     :					Optional[torch.Tensor] = None,			_UpperCAmelCase     :					Optional[bool] = None,			_UpperCAmelCase     :					Optional[bool] = None,			)				->			Union[tuple, BaseModelOutputWithPoolingAndNoAttention]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      str     =						(
														    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
														)
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						return_dict if return_dict is not None else self.config.use_return_dict

														if pixel_values is None:
																					raise ValueError("You have to specify pixel_values"						)

														SCREAMING_SNAKE_CASE__       :      Any     =						self.conv_stem(_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						() if output_hidden_states else None

														for i, layer_module in enumerate(self.layer						):
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						layer_module(_UpperCAmelCase						)

																					if output_hidden_states:
																												SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						all_hidden_states + (hidden_states,)

														SCREAMING_SNAKE_CASE__       :      Tuple     =						hidden_states

														if self.pooler is not None:
																					SCREAMING_SNAKE_CASE__       :      Optional[int]     =						torch.flatten(self.pooler(_UpperCAmelCase						),			start_dim=1						)
														else:
																					SCREAMING_SNAKE_CASE__       :      List[str]     =						None

														if not return_dict:
																					return tuple(v for v in [last_hidden_state, pooled_output, all_hidden_states] if v is not None						)

														return BaseModelOutputWithPoolingAndNoAttention(
														    last_hidden_state=_UpperCAmelCase,			pooler_output=_UpperCAmelCase,			hidden_states=_UpperCAmelCase,			)


@add_start_docstrings(
    "\n    MobileNetV1 model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n    ImageNet.\n    "							,     __lowerCamelCase							,     )
class 						lowerCamelCase       (__lowerCamelCase      ):







							"""simple docstring"""




							def __init__( self     :					Union[str, Any],			_UpperCAmelCase     :					MobileNetVaConfig						)				->			None:





														"""simple docstring"""
														super().__init__(_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      str     =						config.num_labels
														SCREAMING_SNAKE_CASE__       :      List[str]     =						MobileNetVaModel(_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						self.mobilenet_va.layer[-1].convolution.out_channels

														# Classifier head
														SCREAMING_SNAKE_CASE__       :      List[str]     =						nn.Dropout(config.classifier_dropout_prob,			inplace=_UpperCAmelCase						)
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						nn.Linear(_UpperCAmelCase,			config.num_labels						) if config.num_labels > 0 else nn.Identity()

														# Initialize weights and apply final processing
														self.post_init()






							@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  A_     ( self     :					Tuple,			_UpperCAmelCase     :					Optional[torch.Tensor] = None,			_UpperCAmelCase     :					Optional[bool] = None,			_UpperCAmelCase     :					Optional[torch.Tensor] = None,			_UpperCAmelCase     :					Optional[bool] = None,			)				->			Union[tuple, ImageClassifierOutputWithNoAttention]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      List[str]     =						return_dict if return_dict is not None else self.config.use_return_dict

														SCREAMING_SNAKE_CASE__       :      str     =						self.mobilenet_va(_UpperCAmelCase,			output_hidden_states=_UpperCAmelCase,			return_dict=_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						outputs.pooler_output if return_dict else outputs[1]

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						self.classifier(self.dropout(_UpperCAmelCase						)						)

														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						None
														if labels is not None:
																					if self.config.problem_type is None:
																												if self.num_labels == 1:
																																			SCREAMING_SNAKE_CASE__       :      Any     =						"regression"
																												elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
																																			SCREAMING_SNAKE_CASE__       :      Optional[int]     =						"single_label_classification"
																												else:
																																			SCREAMING_SNAKE_CASE__       :      Optional[int]     =						"multi_label_classification"

																					if self.config.problem_type == "regression":
																												SCREAMING_SNAKE_CASE__       :      Dict     =						MSELoss()
																												if self.num_labels == 1:
																																			SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						loss_fct(logits.squeeze(),			labels.squeeze()						)
																												else:
																																			SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						loss_fct(_UpperCAmelCase,			_UpperCAmelCase						)
																					elif self.config.problem_type == "single_label_classification":
																												SCREAMING_SNAKE_CASE__       :      int     =						CrossEntropyLoss()
																												SCREAMING_SNAKE_CASE__       :      int     =						loss_fct(logits.view(-1,			self.num_labels						),			labels.view(-1						)						)
																					elif self.config.problem_type == "multi_label_classification":
																												SCREAMING_SNAKE_CASE__       :      str     =						BCEWithLogitsLoss()
																												SCREAMING_SNAKE_CASE__       :      Dict     =						loss_fct(_UpperCAmelCase,			_UpperCAmelCase						)

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

														return ImageClassifierOutputWithNoAttention(
														    loss=_UpperCAmelCase,			logits=_UpperCAmelCase,			hidden_states=outputs.hidden_states,			)













def _a (  SCREAMING_SNAKE_CASE__      :  str       )	->    str:

							'''simple docstring'''






							if not all(char in "01" for char in bin_string       ):
														raise ValueError("Non-binary value was passed to the function"       )
							if not bin_string:
														raise ValueError("Empty string was passed to the function"       )
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						""
							while len(SCREAMING_SNAKE_CASE__       ) % 3 != 0:
														SCREAMING_SNAKE_CASE__       :      str     =						"0" + bin_string
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						[
							    bin_string[index : index + 3]
							    for index in range(len(SCREAMING_SNAKE_CASE__       )       )
							    if index % 3 == 0
							]
							for bin_group in bin_string_in_3_list:
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						0
														for index, val in enumerate(SCREAMING_SNAKE_CASE__       ):
																					oct_val += int(2 ** (2 - index) * int(SCREAMING_SNAKE_CASE__       )       )
														oct_string += str(SCREAMING_SNAKE_CASE__       )
							return oct_string


if __name__ == "__main__":
		from doctest import testmod

		testmod()






