

"""simple docstring"""




def 		A    (       snake_case__      ):




			'''simple docstring'''


			SCREAMING_SNAKE_CASE__									= len(snake_case__      )

			# Set the gap value to be decreased by a factor of 1.3
			# after each iteration
			SCREAMING_SNAKE_CASE__									= 1.3

			# Continue sorting until the gap is 1
			while gap > 1:
						# Decrease the gap value
						SCREAMING_SNAKE_CASE__									= int(gap / shrink      )

						# Sort the elements using insertion sort
						for i in range(snake_case__						,			len(snake_case__      )      ):
									SCREAMING_SNAKE_CASE__									= collection[i]
									SCREAMING_SNAKE_CASE__									= i
									while j >= gap and collection[j - gap] > temp:
												SCREAMING_SNAKE_CASE__									= collection[j - gap]
												j -= gap
									SCREAMING_SNAKE_CASE__									= temp

			return collection


if __name__ == "__main__":
						import doctest

						doctest.testmod()






"""simple docstring"""




import importlib.metadata
import subprocess
import sys

def 		A    (       snake_case__ = False      ):




			'''simple docstring'''


			SCREAMING_SNAKE_CASE__									= False
			if "IPython" in sys.modules:
						SCREAMING_SNAKE_CASE__									= """google.colab""" in str(sys.modules["""IPython"""].get_ipython()      )

			if in_colab:
						if upgrade:
									SCREAMING_SNAKE_CASE__									= ["""pip""", """install""", """-U""", """torch"""]
									subprocess.run(snake_case__						,			check=snake_case__      )
						# get the current version of torch
						SCREAMING_SNAKE_CASE__									= importlib.metadata.version("""torch"""      )
						SCREAMING_SNAKE_CASE__									= torch_version[: torch_version.rindex("""."""      )]
						SCREAMING_SNAKE_CASE__									= f"""https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl"""
						SCREAMING_SNAKE_CASE__									= ["""pip""", """install""", xla_wheel]
						subprocess.run(snake_case__						,			check=snake_case__      )
			else:
						raise RuntimeError("""`install_xla` utility works only on google colab."""      )


