



from __future__ import annotations

import inspect
import unittest

from transformers import MobileViTConfig
from transformers.file_utils import is_tf_available, is_vision_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
	import numpy as np
	import tensorflow as tf

	from transformers import TFMobileViTForImageClassification, TFMobileViTForSemanticSegmentation, TFMobileViTModel
	from transformers.models.mobilevit.modeling_tf_mobilevit import TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
	from PIL import Image

	from transformers import MobileViTImageProcessor







class 							_a							(      _lowerCAmelCase				):

			def     __snake_case					(self				)					->      Optional[Any]:
						UpperCAmelCase_:		List[Any]       			=    self.config_class(**self.inputs_dict				)
						self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE_,      """hidden_sizes"""				)				)
						self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE_,      """neck_hidden_sizes"""				)				)
						self.parent.assertTrue(hasattr(SCREAMING_SNAKE_CASE_,      """num_attention_heads"""				)				)







class 							_a							:

			def __init__(self,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_=13,      SCREAMING_SNAKE_CASE_=32,      SCREAMING_SNAKE_CASE_=2,      SCREAMING_SNAKE_CASE_=3,      SCREAMING_SNAKE_CASE_=640,      SCREAMING_SNAKE_CASE_=4,      SCREAMING_SNAKE_CASE_="silu",      SCREAMING_SNAKE_CASE_=3,      SCREAMING_SNAKE_CASE_=32,      SCREAMING_SNAKE_CASE_=0.1,      SCREAMING_SNAKE_CASE_=0.1,      SCREAMING_SNAKE_CASE_=0.1,      SCREAMING_SNAKE_CASE_=0.0_2,      SCREAMING_SNAKE_CASE_=True,      SCREAMING_SNAKE_CASE_=True,      SCREAMING_SNAKE_CASE_=10,      SCREAMING_SNAKE_CASE_=None,      )					->      Optional[int]:
						UpperCAmelCase_:		str       			=    parent
						UpperCAmelCase_:		List[Any]       			=    batch_size
						UpperCAmelCase_:		Optional[int]       			=    image_size
						UpperCAmelCase_:		Tuple       			=    patch_size
						UpperCAmelCase_:		Tuple       			=    num_channels
						UpperCAmelCase_:		Tuple       			=    last_hidden_size
						UpperCAmelCase_:		Dict       			=    num_attention_heads
						UpperCAmelCase_:		Optional[Any]       			=    hidden_act
						UpperCAmelCase_:		int       			=    conv_kernel_size
						UpperCAmelCase_:		Optional[int]       			=    output_stride
						UpperCAmelCase_:		Any       			=    hidden_dropout_prob
						UpperCAmelCase_:		Dict       			=    attention_probs_dropout_prob
						UpperCAmelCase_:		Optional[Any]       			=    classifier_dropout_prob
						UpperCAmelCase_:		List[Any]       			=    use_labels
						UpperCAmelCase_:		Optional[Any]       			=    is_training
						UpperCAmelCase_:		Dict       			=    num_labels
						UpperCAmelCase_:		Dict       			=    initializer_range
						UpperCAmelCase_:		List[Any]       			=    scope

			def     __snake_case					(self				)					->      List[str]:
						UpperCAmelCase_:		List[Any]       			=    floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]				)

						UpperCAmelCase_:		List[str]       			=    None
						UpperCAmelCase_:		Optional[Any]       			=    None
						if self.use_labels:
									UpperCAmelCase_:		Dict       			=    ids_tensor([self.batch_size],      self.num_labels				)
									UpperCAmelCase_:		Dict       			=    ids_tensor([self.batch_size, self.image_size, self.image_size],      self.num_labels				)

						UpperCAmelCase_:		Optional[int]       			=    self.get_config()

						return config, pixel_values, labels, pixel_labels

			def     __snake_case					(self				)					->      Optional[Any]:
						return MobileViTConfig(
						    image_size=self.image_size,      patch_size=self.patch_size,      num_channels=self.num_channels,      num_attention_heads=self.num_attention_heads,      hidden_act=self.hidden_act,      conv_kernel_size=self.conv_kernel_size,      output_stride=self.output_stride,      hidden_dropout_prob=self.hidden_dropout_prob,      attention_probs_dropout_prob=self.attention_probs_dropout_prob,      classifier_dropout_prob=self.classifier_dropout_prob,      initializer_range=self.initializer_range,      )

			def     __snake_case					(self,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)					->      str:
						UpperCAmelCase_:		Any       			=    TFMobileViTModel(config=SCREAMING_SNAKE_CASE_				)
						UpperCAmelCase_:		Any       			=    model(SCREAMING_SNAKE_CASE_,      training=SCREAMING_SNAKE_CASE_				)
						UpperCAmelCase_:		int       			=    self.image_size // self.output_stride
						self.parent.assertEqual(
						    result.last_hidden_state.shape,      (self.batch_size, self.last_hidden_size, expected_height, expected_width)				)

			def     __snake_case					(self,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)					->      Dict:
						UpperCAmelCase_:		Optional[int]       			=    self.num_labels
						UpperCAmelCase_:		Union[str, Any]       			=    TFMobileViTForImageClassification(SCREAMING_SNAKE_CASE_				)
						UpperCAmelCase_:		Optional[int]       			=    model(SCREAMING_SNAKE_CASE_,      labels=SCREAMING_SNAKE_CASE_,      training=SCREAMING_SNAKE_CASE_				)
						self.parent.assertEqual(result.logits.shape,      (self.batch_size, self.num_labels)				)

			def     __snake_case					(self,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)					->      Union[str, Any]:
						UpperCAmelCase_:		List[Any]       			=    self.num_labels
						UpperCAmelCase_:		List[str]       			=    TFMobileViTForSemanticSegmentation(SCREAMING_SNAKE_CASE_				)
						UpperCAmelCase_:		List[str]       			=    self.image_size // self.output_stride

						UpperCAmelCase_:		Union[str, Any]       			=    model(SCREAMING_SNAKE_CASE_,      training=SCREAMING_SNAKE_CASE_				)
						self.parent.assertEqual(
						    result.logits.shape,      (self.batch_size, self.num_labels, expected_height, expected_width)				)

						UpperCAmelCase_:		int       			=    model(SCREAMING_SNAKE_CASE_,      labels=SCREAMING_SNAKE_CASE_,      training=SCREAMING_SNAKE_CASE_				)
						self.parent.assertEqual(
						    result.logits.shape,      (self.batch_size, self.num_labels, expected_height, expected_width)				)

			def     __snake_case					(self				)					->      Optional[Any]:
						UpperCAmelCase_:		List[Any]       			=    self.prepare_config_and_inputs()
						UpperCAmelCase_			,       UpperCAmelCase_			,       UpperCAmelCase_			,       UpperCAmelCase_:		Optional[int]       			=    config_and_inputs
						UpperCAmelCase_:		str       			=    {"""pixel_values""": pixel_values}
						return config, inputs_dict







@require_tf
class 							_a							(      _lowerCAmelCase   ,		_lowerCAmelCase   ,		unittest.TestCase				):
			A					=  (
			    (TFMobileViTModel, TFMobileViTForImageClassification, TFMobileViTForSemanticSegmentation)
			    if is_tf_available()
			    else ()
			)
			A					=  (
			    {'''feature-extraction''': TFMobileViTModel, '''image-classification''': TFMobileViTForImageClassification}
			    if is_tf_available()
			    else {}
			)

			A					=  False
			A					=  False
			A					=  False
			A					=  False
			A					=  False

			def     __snake_case					(self				)					->      Union[str, Any]:
						UpperCAmelCase_:		int       			=    TFMobileViTModelTester(self				)
						UpperCAmelCase_:		Optional[int]       			=    TFMobileViTConfigTester(self,      config_class=SCREAMING_SNAKE_CASE_,      has_text_modality=SCREAMING_SNAKE_CASE_				)

			def     __snake_case					(self				)					->      str:
						self.config_tester.run_common_tests()

			@unittest.skip(reason="""MobileViT does not use inputs_embeds"""				)
			def     __snake_case					(self				)					->      Any:
						pass

			@unittest.skip(reason="""MobileViT does not support input and output embeddings"""				)
			def     __snake_case					(self				)					->      Union[str, Any]:
						pass

			@unittest.skip(reason="""MobileViT does not output attentions"""				)
			def     __snake_case					(self				)					->      int:
						pass

			def     __snake_case					(self				)					->      Optional[Any]:
						UpperCAmelCase_			,       UpperCAmelCase_:		Dict       			=    self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
									UpperCAmelCase_:		int       			=    model_class(SCREAMING_SNAKE_CASE_				)
									UpperCAmelCase_:		List[Any]       			=    inspect.signature(model.call				)
									# signature.parameters is an OrderedDict => so arg_names order is deterministic
									UpperCAmelCase_:		List[str]       			=    [*signature.parameters.keys()]

									UpperCAmelCase_:		List[Any]       			=    ["""pixel_values"""]
									self.assertListEqual(arg_names[:1],      SCREAMING_SNAKE_CASE_				)

			def     __snake_case					(self				)					->      List[Any]:
						UpperCAmelCase_:		Optional[int]       			=    self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_model(*SCREAMING_SNAKE_CASE_				)

			def     __snake_case					(self				)					->      Any:
						def check_hidden_states_output(SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				):
									UpperCAmelCase_:		Optional[int]       			=    model_class(SCREAMING_SNAKE_CASE_				)

									UpperCAmelCase_:		int       			=    model(**self._prepare_for_class(SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)				)

									UpperCAmelCase_:		str       			=    outputs.hidden_states

									UpperCAmelCase_:		List[Any]       			=    5
									self.assertEqual(len(SCREAMING_SNAKE_CASE_				),      SCREAMING_SNAKE_CASE_				)

									# MobileViT's feature maps are of shape (batch_size, num_channels, height, width)
									# with the width and height being successively divided by 2.
									UpperCAmelCase_:		int       			=    2
									for i in range(len(SCREAMING_SNAKE_CASE_				)				):
												self.assertListEqual(
												    list(hidden_states[i].shape[-2:]				),      [self.model_tester.image_size // divisor, self.model_tester.image_size // divisor],      )
												divisor *= 2

									self.assertEqual(self.model_tester.output_stride,      divisor // 2				)

						UpperCAmelCase_			,       UpperCAmelCase_:		Dict       			=    self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
									UpperCAmelCase_:		Optional[int]       			=    True
									check_hidden_states_output(SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)

									# check that output_hidden_states also work using config
									del inputs_dict["output_hidden_states"]
									UpperCAmelCase_:		Union[str, Any]       			=    True

									check_hidden_states_output(SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_				)

			def     __snake_case					(self				)					->      Optional[int]:
						UpperCAmelCase_:		Dict       			=    self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_image_classification(*SCREAMING_SNAKE_CASE_				)

			def     __snake_case					(self				)					->      Union[str, Any]:
						UpperCAmelCase_:		List[Any]       			=    self.model_tester.prepare_config_and_inputs()
						self.model_tester.create_and_check_for_semantic_segmentation(*SCREAMING_SNAKE_CASE_				)

			@unittest.skipIf(
			    not is_tf_available() or len(tf.config.list_physical_devices("""GPU"""				)				) == 0,      reason="""TF does not support backprop for grouped convolutions on CPU.""",      )
			def     __snake_case					(self				)					->      int:
						super().test_dataset_conversion()

			def     __snake_case					(self,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_=2E-1,      SCREAMING_SNAKE_CASE_=2E-1				)					->      List[str]:
						self.assertTrue(np.allclose(SCREAMING_SNAKE_CASE_,      SCREAMING_SNAKE_CASE_,      atol=SCREAMING_SNAKE_CASE_,      rtol=SCREAMING_SNAKE_CASE_				)				)

			@unittest.skipIf(
			    not is_tf_available() or len(tf.config.list_physical_devices("""GPU"""				)				) == 0,      reason="""TF does not support backprop for grouped convolutions on CPU.""",      )
			@slow
			def     __snake_case					(self				)					->      str:
						UpperCAmelCase_			,       UpperCAmelCase_:		List[str]       			=    self.model_tester.prepare_config_and_inputs_for_common()

						for model_class in self.all_model_classes:
									# Since `TFMobileViTModel` cannot operate with the default `fit()` method.
									if model_class.__name__ != "TFMobileViTModel":
												UpperCAmelCase_:		Optional[Any]       			=    model_class(SCREAMING_SNAKE_CASE_				)
												if getattr(SCREAMING_SNAKE_CASE_,      """hf_compute_loss""",      SCREAMING_SNAKE_CASE_				):
															super().test_keras_fit()

			def     __snake_case					(self				)					->      List[Any]:
						UpperCAmelCase_			,       UpperCAmelCase_:		List[Any]       			=    self.model_tester.prepare_config_and_inputs_for_common()
						for model_class in self.all_model_classes:
									# set an ignore index to correctly test the masked loss used in
									# `TFMobileViTForSemanticSegmentation`.
									if model_class.__name__ != "TFMobileViTForSemanticSegmentation":
												UpperCAmelCase_:		Any       			=    5

									UpperCAmelCase_:		Optional[Any]       			=    model_class(SCREAMING_SNAKE_CASE_				)
									if getattr(SCREAMING_SNAKE_CASE_,      """hf_compute_loss""",      SCREAMING_SNAKE_CASE_				):
												# The number of elements in the loss should be the same as the number of elements in the label
												UpperCAmelCase_:		Optional[int]       			=    self._prepare_for_class(inputs_dict.copy(),      SCREAMING_SNAKE_CASE_,      return_labels=SCREAMING_SNAKE_CASE_				)
												UpperCAmelCase_:		Union[str, Any]       			=    prepared_for_class[
												    sorted(prepared_for_class.keys() - inputs_dict.keys(),      reverse=SCREAMING_SNAKE_CASE_				)[0]
												]
												UpperCAmelCase_:		List[str]       			=    added_label.shape.as_list()[:1]

												# Test that model correctly compute the loss with kwargs
												UpperCAmelCase_:		List[Any]       			=    self._prepare_for_class(inputs_dict.copy(),      SCREAMING_SNAKE_CASE_,      return_labels=SCREAMING_SNAKE_CASE_				)
												UpperCAmelCase_:		List[Any]       			=    {"""input_ids""", """pixel_values""", """input_features"""}
												UpperCAmelCase_:		Tuple       			=    possible_input_names.intersection(set(SCREAMING_SNAKE_CASE_				)				).pop()
												UpperCAmelCase_:		Dict       			=    prepared_for_class.pop(SCREAMING_SNAKE_CASE_				)

												UpperCAmelCase_:		Union[str, Any]       			=    model(SCREAMING_SNAKE_CASE_,      **SCREAMING_SNAKE_CASE_				)[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]				)

												# Test that model correctly compute the loss when we mask some positions
												UpperCAmelCase_:		Any       			=    self._prepare_for_class(inputs_dict.copy(),      SCREAMING_SNAKE_CASE_,      return_labels=SCREAMING_SNAKE_CASE_				)
												UpperCAmelCase_:		str       			=    {"""input_ids""", """pixel_values""", """input_features"""}
												UpperCAmelCase_:		Optional[Any]       			=    possible_input_names.intersection(set(SCREAMING_SNAKE_CASE_				)				).pop()
												UpperCAmelCase_:		str       			=    prepared_for_class.pop(SCREAMING_SNAKE_CASE_				)
												if "labels" in prepared_for_class:
															UpperCAmelCase_:		int       			=    prepared_for_class["""labels"""].numpy()
															if len(labels.shape				) > 1 and labels.shape[1] != 1:
																		# labels[0] = -100
																		UpperCAmelCase_:		int       			=    tf.convert_to_tensor(SCREAMING_SNAKE_CASE_				)
																		UpperCAmelCase_:		Union[str, Any]       			=    model(SCREAMING_SNAKE_CASE_,      **SCREAMING_SNAKE_CASE_				)[0]
																		self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]				)
																		self.assertTrue(not np.any(np.isnan(loss.numpy()				)				)				)

                # Test that model correctly compute the loss with a dict
												UpperCAmelCase_:		Dict       			=    self._prepare_for_class(inputs_dict.copy(),      SCREAMING_SNAKE_CASE_,      return_labels=SCREAMING_SNAKE_CASE_				)
												UpperCAmelCase_:		str       			=    model(SCREAMING_SNAKE_CASE_				)[0]
												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]				)

												# Test that model correctly compute the loss with a tuple
												UpperCAmelCase_:		List[str]       			=    self._prepare_for_class(inputs_dict.copy(),      SCREAMING_SNAKE_CASE_,      return_labels=SCREAMING_SNAKE_CASE_				)

												# Get keys that were added with the _prepare_for_class function
												UpperCAmelCase_:		int       			=    prepared_for_class.keys() - inputs_dict.keys()
												UpperCAmelCase_:		int       			=    inspect.signature(model.call				).parameters
												UpperCAmelCase_:		List[str]       			=    list(signature.keys()				)

												# Create a dictionary holding the location of the tensors in the tuple
												UpperCAmelCase_:		List[str]       			=    {0: input_name}
												for label_key in label_keys:
															UpperCAmelCase_:		Optional[int]       			=    signature_names.index(SCREAMING_SNAKE_CASE_				)
															UpperCAmelCase_:		Any       			=    label_key
												UpperCAmelCase_:		Tuple       			=    sorted(tuple_index_mapping.items()				)
												# Initialize a list with their default values, update the values and convert to a tuple
												UpperCAmelCase_:		int       			=    []

												for name in signature_names:
															if name != "kwargs":
																		list_input.append(signature[name].default				)

												for index, value in sorted_tuple_index_mapping:
															UpperCAmelCase_:		int       			=    prepared_for_class[value]

												UpperCAmelCase_:		Optional[int]       			=    tuple(SCREAMING_SNAKE_CASE_				)

												# Send to model
												UpperCAmelCase_:		Tuple       			=    model(tuple_input[:-1]				)[0]

												self.assertTrue(loss.shape.as_list() == expected_loss_size or loss.shape.as_list() == [1]				)

			@slow
			def     __snake_case					(self				)					->      Optional[int]:
						for model_name in TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									UpperCAmelCase_:		Any       			=    TFMobileViTModel.from_pretrained(SCREAMING_SNAKE_CASE_				)
									self.assertIsNotNone(SCREAMING_SNAKE_CASE_				)







def    lowerCAmelCase_  ():





			"""simple docstring"""


			UpperCAmelCase_:		Tuple       			=    Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""     )
			return image







@require_tf
class 							_a							(      unittest.TestCase				):

			@slow
			def     __snake_case					(self				)					->      Optional[int]:
						UpperCAmelCase_:		int       			=    TFMobileViTForImageClassification.from_pretrained("""apple/mobilevit-xx-small"""				)

						UpperCAmelCase_:		Union[str, Any]       			=    MobileViTImageProcessor.from_pretrained("""apple/mobilevit-xx-small"""				)
						UpperCAmelCase_:		str       			=    prepare_img()
						UpperCAmelCase_:		Tuple       			=    image_processor(images=SCREAMING_SNAKE_CASE_,      return_tensors="""tf"""				)

						# forward pass
						UpperCAmelCase_:		Union[str, Any]       			=    model(**SCREAMING_SNAKE_CASE_,      training=SCREAMING_SNAKE_CASE_				)

						# verify the logits
						UpperCAmelCase_:		List[str]       			=    tf.TensorShape((1, 1000)				)
						self.assertEqual(outputs.logits.shape,      SCREAMING_SNAKE_CASE_				)

						UpperCAmelCase_:		Optional[int]       			=    tf.constant([-1.9_3_6_4, -1.2_3_2_7, -0.4_6_5_3]				)

						tf.debugging.assert_near(outputs.logits[0, :3],      SCREAMING_SNAKE_CASE_,      atol=1E-4,      rtol=1E-04				)

			@slow
			def     __snake_case					(self				)					->      Optional[Any]:
						# `from_pt` will be removed
						UpperCAmelCase_:		int       			=    TFMobileViTForSemanticSegmentation.from_pretrained("""apple/deeplabv3-mobilevit-xx-small"""				)

						UpperCAmelCase_:		Tuple       			=    MobileViTImageProcessor.from_pretrained("""apple/deeplabv3-mobilevit-xx-small"""				)

						UpperCAmelCase_:		str       			=    prepare_img()
						UpperCAmelCase_:		List[str]       			=    image_processor(images=SCREAMING_SNAKE_CASE_,      return_tensors="""tf"""				)

						# forward pass
						UpperCAmelCase_:		Optional[int]       			=    model(inputs.pixel_values,      training=SCREAMING_SNAKE_CASE_				)
						UpperCAmelCase_:		str       			=    outputs.logits

						# verify the logits
						UpperCAmelCase_:		str       			=    tf.TensorShape((1, 21, 32, 32)				)
						self.assertEqual(logits.shape,      SCREAMING_SNAKE_CASE_				)

						UpperCAmelCase_:		Tuple       			=    tf.constant(
						    [
						        [[6.9_7_1_3, 6.9_7_8_6, 7.2_4_2_2], [7.2_8_9_3, 7.2_8_2_5, 7.4_4_4_6], [7.6_5_8_0, 7.8_7_9_7, 7.9_4_2_0]],
						        [[-1_0.6_8_6_9, -1_0.3_2_5_0, -1_0.3_4_7_1], [-1_0.4_2_2_8, -9.9_8_6_8, -9.7_1_3_2], [-1_1.0_4_0_5, -1_1.0_2_2_1, -1_0.7_3_1_8]],
						        [[-3.3_0_8_9, -2.8_5_3_9, -2.6_7_4_0], [-3.2_7_0_6, -2.5_6_2_1, -2.5_1_0_8], [-3.2_5_3_4, -2.6_6_1_5, -2.6_6_5_1]],
						    ]				)

						tf.debugging.assert_near(logits[0, :3, :3, :3],      SCREAMING_SNAKE_CASE_,      rtol=1E-4,      atol=1E-4				)











import numpy as np







def    lowerCAmelCase_  (lowerCAmelCase__:		Optional[Any]     ):





			"""simple docstring"""


			UpperCAmelCase_:		Optional[int]       			=    np.exp(lowerCAmelCase__     )

			# Add up the all the exponentials
			UpperCAmelCase_:		Tuple       			=    np.sum(lowerCAmelCase__     )

			# Divide every exponent by the sum of all exponents
			UpperCAmelCase_:		str       			=    exponent_vector / sum_of_exponents

			return softmax_vector


if __name__ == "__main__":
	print(softmax((0,)))






