

"""simple docstring"""





import argparse
import json
import os
from collections import OrderedDict

import numpy as np
import tensorflow as tf
import torch

def   __SCREAMING_SNAKE_CASE  (      A_ ):
	lowerCAmelCase__	:						Any  				=	os.path.join(args.tf_model_dir						,     '''parameters.json''' )
	lowerCAmelCase__	:						List[Any]  				=	json.loads(open(SCREAMING_SNAKE_CASE_ ).read() )
	if not params:
		raise ValueError(
		    f'It seems that the json file at {parameter_file} is empty. Make sure you have a correct json file.' )
	if not args.output.endswith('''.pt''' ):
		lowerCAmelCase__	:						List[Any]  				=	args.output + '''.pt'''
	lowerCAmelCase__	:						Optional[Any]  				=	OrderedDict()
	with tf.device('''/CPU:0''' ):
		lowerCAmelCase__	:						Dict  				=	tf.train.load_checkpoint(args.tf_model_dir )
		lowerCAmelCase__	:						Optional[Any]  				=	reader.get_variable_to_shape_map()
		for key_name in shapes.keys():
			lowerCAmelCase__	:						List[Any]  				=	reader.get_tensor(SCREAMING_SNAKE_CASE_ ).astype(np.floataa )
			if key_name.endswith('''/adam_m''' ) or key_name.endswith('''/adam_v''' ):
				continue
			if key_name.startswith('''pasts/''' ):
				if key_name.startswith('''pasts/mlp''' ):
					lowerCAmelCase__	:						List[Any]  				=	int(key_name[9] )
				elif key_name.startswith('''pasts/out''' ):
					lowerCAmelCase__	:						Dict  				=	8
				lowerCAmelCase__	:						Union[str, Any]  				=	'''model.sqout.%d.weight''' % (player * 2)  # enter to nn.Sequencial with Tanh, so 2 at a time
				lowerCAmelCase__	:						List[Any]  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
				lowerCAmelCase__	:						Any  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/moe''' ):
				lowerCAmelCase__	:						List[Any]  				=	int(key_name[9:].split('''/''' )[0] )
				if key_name.endswith('''/switch_gating/kernel''' ):
					lowerCAmelCase__	:						Optional[int]  				=	'''model.blocks.%d.feed_forward.mlp.router.classifier.weight''' % player
					lowerCAmelCase__	:						Optional[Any]  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Dict  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/softmlp/kernel''' ):
					lowerCAmelCase__	:						Any  				=	'''model.blocks.%d.feed_forward.soft_bypass_mlp.weight''' % player
					lowerCAmelCase__	:						int  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/wo/kernel''' ) or key_name.endswith('''/wi/kernel''' ):
					lowerCAmelCase__	:						Any  				=	key_name[-9:-7]
					for i in range(16 ):
						lowerCAmelCase__	:						Any  				=	'''model.blocks.%d.feed_forward.mlp.experts.expert_%d.%s.weight''' % (player, i, nlayer)
						lowerCAmelCase__	:						Union[str, Any]  				=	(
						    vnp[i].transpose([1, 0] ).copy()
						)  # In Mesh-Tensorflow, it is one array, so it is divided
						lowerCAmelCase__	:						List[str]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/mlp''' ):
				lowerCAmelCase__	:						Tuple  				=	int(key_name[9:].split('''/''' )[0] )
				if key_name.endswith('''/p1/kernel''' ):
					lowerCAmelCase__	:						str  				=	'''model.blocks.%d.feed_forward.mlp.wi.weight''' % player
					lowerCAmelCase__	:						Tuple  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/p1/bias''' ):
					lowerCAmelCase__	:						Dict  				=	'''model.blocks.%d.feed_forward.mlp.wi.bias''' % player
					lowerCAmelCase__	:						Tuple  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						str  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/p2/kernel''' ):
					lowerCAmelCase__	:						Union[str, Any]  				=	'''model.blocks.%d.feed_forward.mlp.wo.weight''' % player
					lowerCAmelCase__	:						Optional[int]  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						List[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/p2/bias''' ):
					lowerCAmelCase__	:						Any  				=	'''model.blocks.%d.feed_forward.mlp.wo.bias''' % player
					lowerCAmelCase__	:						Optional[Any]  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						Any  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/ln''' ):
				lowerCAmelCase__	:						Optional[int]  				=	int(key_name[8:].split('''/''' )[0] )
				if key_name.endswith('''/b''' ):
					lowerCAmelCase__	:						int  				=	'''model.blocks.%d.feed_forward.norm.bias''' % player
					lowerCAmelCase__	:						List[Any]  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						int  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/g''' ):
					lowerCAmelCase__	:						Union[str, Any]  				=	'''model.blocks.%d.feed_forward.norm.weight''' % player
					lowerCAmelCase__	:						List[str]  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						Dict  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/att''' ):
				lowerCAmelCase__	:						Tuple  				=	int(key_name[9:].split('''/''' )[0] )
				if key_name.endswith('''/qkv/kernel''' ):
					lowerCAmelCase__	:						Tuple  				=	vnp.copy()  # Compute same dimension as Mesh-tensorflow using einsum
					lowerCAmelCase__	:						List[str]  				=	state[:, 0, :, :]
					lowerCAmelCase__	:						Dict  				=	state[:, 1, :, :]
					lowerCAmelCase__	:						Optional[int]  				=	state[:, 2, :, :]
					lowerCAmelCase__	:						str  				=	(
					    state_q.reshape([state_q.shape[0], state_q.shape[1] * state_q.shape[2]] )
					    .transpose([1, 0] )
					    .copy()
					)  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Tuple  				=	(
					    state_k.reshape([state_k.shape[0], state_k.shape[1] * state_k.shape[2]] )
					    .transpose([1, 0] )
					    .copy()
					)  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						int  				=	(
					    state_v.reshape([state_v.shape[0], state_v.shape[1] * state_v.shape[2]] )
					    .transpose([1, 0] )
					    .copy()
					)  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Any  				=	'''model.blocks.%d.self_attn.self_attn.q_proj.weight''' % player
					lowerCAmelCase__	:						Tuple  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
					lowerCAmelCase__	:						Any  				=	'''model.blocks.%d.self_attn.self_attn.k_proj.weight''' % player
					lowerCAmelCase__	:						Tuple  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
					lowerCAmelCase__	:						int  				=	'''model.blocks.%d.self_attn.self_attn.v_proj.weight''' % player
					lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/o/kernel''' ):
					lowerCAmelCase__	:						Dict  				=	'''model.blocks.%d.self_attn.self_attn.out_proj.weight''' % player
					lowerCAmelCase__	:						Union[str, Any]  				=	(
					    vnp.reshape([vnp.shape[0] * vnp.shape[1], vnp.shape[2]] ).transpose([1, 0] ).copy()
					)  # Mesh-Tensorflow is a diagonal matrix
					lowerCAmelCase__	:						Union[str, Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/an''' ):
				lowerCAmelCase__	:						Union[str, Any]  				=	int(key_name[8:].split('''/''' )[0] )
				if key_name.endswith('''/b''' ):
					lowerCAmelCase__	:						List[Any]  				=	'''model.blocks.%d.self_attn.norm.bias''' % player
					lowerCAmelCase__	:						int  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						Dict  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				elif key_name.endswith('''/g''' ):
					lowerCAmelCase__	:						List[Any]  				=	'''model.blocks.%d.self_attn.norm.weight''' % player
					lowerCAmelCase__	:						Dict  				=	vnp.copy()  # same because it is one dimensional
					lowerCAmelCase__	:						int  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif (
			    key_name.startswith('''model/wte''' )
			    or key_name.startswith('''model/wpe''' )
			    or key_name.startswith('''model/ete''' )
			):
				lowerCAmelCase__	:						Optional[Any]  				=	{'''wte''': '''embed_tokens''', '''wpe''': '''position_embeddings''', '''ete''': '''extra_position_embeddings'''}[
				    key_name[-3:]
				]
				lowerCAmelCase__	:						Union[str, Any]  				=	'''model.%s.weight''' % nlayer
				lowerCAmelCase__	:						Tuple  				=	vnp.copy()  # same in embedded
				lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
				if key_name.startswith('''model/wte''' ):
					lowerCAmelCase__	:						Tuple  				=	'''lm_head.weight'''
					lowerCAmelCase__	:						Optional[Any]  				=	vnp.copy()  # same in embedded
					lowerCAmelCase__	:						Tuple  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name.startswith('''model/wob''' ):
				lowerCAmelCase__	:						Any  				=	'''final_logits_bias'''
				lowerCAmelCase__	:						Any  				=	vnp.copy()  # same in embedded
				lowerCAmelCase__	:						Optional[int]  				=	state.reshape((1, -1) )
				lowerCAmelCase__	:						List[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name == "model/dense/kernel":
				lowerCAmelCase__	:						int  				=	'''model.last_project.weight'''
				lowerCAmelCase__	:						str  				=	vnp.transpose([1, 0] ).copy()  # Mesh-Tensorflow is a diagonal matrix
				lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
			elif key_name == "model/dense_1/bias":
				lowerCAmelCase__	:						int  				=	'''model.last_project.bias'''
				lowerCAmelCase__	:						List[str]  				=	vnp.copy()  # same because it is one dimensional
				lowerCAmelCase__	:						Optional[Any]  				=	torch.tensor(SCREAMING_SNAKE_CASE_ )
	torch.save(SCREAMING_SNAKE_CASE_						,     args.output )


if __name__ == "__main__":
							__UpperCamelCase  :      str							      =		argparse.ArgumentParser(
							    description='''model converter.''', formatter_class=argparse.ArgumentDefaultsHelpFormatter
							)
							parser.add_argument('''--tf_model_dir''', metavar='''PATH''', type=str, required=True, help='''import model''')
							parser.add_argument('''--output''', metavar='''PATH''', type=str, required=True, help='''output model''')
							__UpperCamelCase  :      Dict							      =		parser.parse_args()
							convert_tf_gptsan_to_pt(args)








"""simple docstring"""




from __future__ import annotations

import math
import random
from collections.abc import Collection
from typing import overload
class 					lowerCAmelCase	:




		'''simple docstring'''







		def __init__(	self						,       lowerCAmelCase__ = None				)     ->							None:
								if components is None:
														SCREAMING_SNAKE_CASE													=					[]
								SCREAMING_SNAKE_CASE													=					list(lowerCAmelCase__				)







		def __len__(	self				)     ->							int:
								return len(self.__components				)







		def __str__(	self				)     ->							str:
								return "(" + ",".join(map(lowerCAmelCase__						,       self.__components				)				) + ")"







		def __add__(	self						,       lowerCAmelCase__				)     ->							Vector:
								SCREAMING_SNAKE_CASE													=					len(self				)
								if size == len(lowerCAmelCase__				):
														SCREAMING_SNAKE_CASE													=					[self.__components[i] + other.component(lowerCAmelCase__				) for i in range(lowerCAmelCase__				)]
														return Vector(lowerCAmelCase__				)
								else:
														raise Exception('must have the same size'				)







		def __sub__(	self						,       lowerCAmelCase__				)     ->							Vector:
								SCREAMING_SNAKE_CASE													=					len(self				)
								if size == len(lowerCAmelCase__				):
														SCREAMING_SNAKE_CASE													=					[self.__components[i] - other.component(lowerCAmelCase__				) for i in range(lowerCAmelCase__				)]
														return Vector(lowerCAmelCase__				)
								else:  # error case
														raise Exception('must have the same size'				)







		@overload
		def __mul__(	self						,       lowerCAmelCase__				)     ->							Vector:
								...







		@overload
		def __mul__(	self						,       lowerCAmelCase__				)     ->							float:
								...







		def __mul__(	self						,       lowerCAmelCase__				)     ->							float | Vector:
								if isinstance(lowerCAmelCase__						,       (float, int)				):
														SCREAMING_SNAKE_CASE													=					[c * other for c in self.__components]
														return Vector(lowerCAmelCase__				)
								elif isinstance(lowerCAmelCase__						,       lowerCAmelCase__				) and len(self				) == len(lowerCAmelCase__				):
														SCREAMING_SNAKE_CASE													=					len(self				)
														SCREAMING_SNAKE_CASE													=					[self.__components[i] * other.component(lowerCAmelCase__				) for i in range(lowerCAmelCase__				)]
														return sum(lowerCAmelCase__				)
								else:  # error case
														raise Exception('invalid operand!'				)







		def 							__A						(	self				)     ->							Vector:
								return Vector(self.__components				)







		def 							__A						(	self						,       lowerCAmelCase__				)     ->							float:
								if isinstance(lowerCAmelCase__						,       lowerCAmelCase__				) and -len(self.__components				) <= i < len(self.__components				):
														return self.__components[i]
								else:
														raise Exception('index out of range'				)







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							None:
								assert -len(self.__components				) <= pos < len(self.__components				)
								SCREAMING_SNAKE_CASE													=					value







		def 							__A						(	self				)     ->							float:
								if len(self.__components				) == 0:
														raise Exception('Vector is empty'				)
								SCREAMING_SNAKE_CASE													=					[c**2 for c in self.__components]
								return math.sqrt(sum(lowerCAmelCase__				)				)







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__ = False				)     ->							float:
								SCREAMING_SNAKE_CASE													=					self * other
								SCREAMING_SNAKE_CASE													=					self.euclidean_length() * other.euclidean_length()
								if deg:
														return math.degrees(math.acos(num / den				)				)
								else:
														return math.acos(num / den				)





def     lowercase			(SCREAMING_SNAKE_CASE_		:				int  )   ->						Vector:
						assert isinstance(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
						return Vector([0] * dimension  )


def     lowercase			(SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int  )   ->						Vector:
						assert isinstance(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ) and (isinstance(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ))
						SCREAMING_SNAKE_CASE													=					[0] * dimension
						SCREAMING_SNAKE_CASE													=					1
						return Vector(SCREAMING_SNAKE_CASE_  )


def     lowercase			(SCREAMING_SNAKE_CASE_		:				float ,			SCREAMING_SNAKE_CASE_		:				Vector ,			SCREAMING_SNAKE_CASE_		:				Vector  )   ->						Vector:
						assert (
						    isinstance(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
						    and isinstance(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )
						    and (isinstance(SCREAMING_SNAKE_CASE_ ,			(int, float)  ))
						)
						return x * scalar + y


def     lowercase			(SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int  )   ->						Vector:
						random.seed(SCREAMING_SNAKE_CASE_  )
						SCREAMING_SNAKE_CASE													=					[random.randint(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ) for _ in range(SCREAMING_SNAKE_CASE_  )]
						return Vector(SCREAMING_SNAKE_CASE_  )
class 					lowerCAmelCase	:




		'''simple docstring'''







		def __init__(	self						,       lowerCAmelCase__						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							None:
								SCREAMING_SNAKE_CASE													=					matrix
								SCREAMING_SNAKE_CASE													=					w
								SCREAMING_SNAKE_CASE													=					h







		def __str__(	self				)     ->							str:
								SCREAMING_SNAKE_CASE													=					''
								for i in range(self.__height				):
														ans += "|"
														for j in range(self.__width				):
																				if j < self.__width - 1:
																										ans += str(self.__matrix[i][j]				) + ","
																				else:
																										ans += str(self.__matrix[i][j]				) + "|\n"
								return ans







		def __add__(	self						,       lowerCAmelCase__				)     ->							Matrix:
								if self.__width == other.width() and self.__height == other.height():
														SCREAMING_SNAKE_CASE													=					[]
														for i in range(self.__height				):
																				SCREAMING_SNAKE_CASE													=					[
																				    self.__matrix[i][j] + other.component(lowerCAmelCase__						,       lowerCAmelCase__				)
																				    for j in range(self.__width				)
																				]
																				matrix.append(lowerCAmelCase__				)
														return Matrix(lowerCAmelCase__						,       self.__width						,       self.__height				)
								else:
														raise Exception('matrix must have the same dimension!'				)







		def __sub__(	self						,       lowerCAmelCase__				)     ->							Matrix:
								if self.__width == other.width() and self.__height == other.height():
														SCREAMING_SNAKE_CASE													=					[]
														for i in range(self.__height				):
																				SCREAMING_SNAKE_CASE													=					[
																				    self.__matrix[i][j] - other.component(lowerCAmelCase__						,       lowerCAmelCase__				)
																				    for j in range(self.__width				)
																				]
																				matrix.append(lowerCAmelCase__				)
														return Matrix(lowerCAmelCase__						,       self.__width						,       self.__height				)
								else:
														raise Exception('matrices must have the same dimension!'				)







		@overload
		def __mul__(	self						,       lowerCAmelCase__				)     ->							Matrix:
								...







		@overload
		def __mul__(	self						,       lowerCAmelCase__				)     ->							Vector:
								...







		def __mul__(	self						,       lowerCAmelCase__				)     ->							Vector | Matrix:
								if isinstance(lowerCAmelCase__						,       lowerCAmelCase__				):  # matrix-vector
														if len(lowerCAmelCase__				) == self.__width:
																				SCREAMING_SNAKE_CASE													=					zero_vector(self.__height				)
																				for i in range(self.__height				):
																										SCREAMING_SNAKE_CASE													=					[
																										    self.__matrix[i][j] * other.component(lowerCAmelCase__				)
																										    for j in range(self.__width				)
																										]
																										ans.change_component(lowerCAmelCase__						,       sum(lowerCAmelCase__				)				)
																				return ans
														else:
																				raise Exception(
																				    'vector must have the same size as the '
																				    'number of columns of the matrix!'				)
								elif isinstance(lowerCAmelCase__						,       (int, float)				):  # matrix-scalar
														SCREAMING_SNAKE_CASE													=					[
														    [self.__matrix[i][j] * other for j in range(self.__width				)]
														    for i in range(self.__height				)
														]
														return Matrix(lowerCAmelCase__						,       self.__width						,       self.__height				)
								return None







		def 							__A						(	self				)     ->							int:
								return self.__height







		def 							__A						(	self				)     ->							int:
								return self.__width







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							float:
								if 0 <= x < self.__height and 0 <= y < self.__width:
														return self.__matrix[x][y]
								else:
														raise Exception('change_component: indices out of bounds'				)







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							None:
								if 0 <= x < self.__height and 0 <= y < self.__width:
														SCREAMING_SNAKE_CASE													=					value
								else:
														raise Exception('change_component: indices out of bounds'				)







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							float:
								if self.__height != self.__width:
														raise Exception('Matrix is not square'				)
								SCREAMING_SNAKE_CASE													=					self.__matrix[:x] + self.__matrix[x + 1 :]
								for i in range(len(lowerCAmelCase__				)				):
														SCREAMING_SNAKE_CASE													=					minor[i][:y] + minor[i][y + 1 :]
								return Matrix(lowerCAmelCase__						,       self.__width - 1						,       self.__height - 1				).determinant()







		def 							__A						(	self						,       lowerCAmelCase__						,       lowerCAmelCase__				)     ->							float:
								if self.__height != self.__width:
														raise Exception('Matrix is not square'				)
								if 0 <= x < self.__height and 0 <= y < self.__width:
														return (-1) ** (x + y) * self.minor(lowerCAmelCase__						,       lowerCAmelCase__				)
								else:
														raise Exception('Indices out of bounds'				)







		def 							__A						(	self				)     ->							float:
								if self.__height != self.__width:
														raise Exception('Matrix is not square'				)
								if self.__height < 1:
														raise Exception('Matrix has no element'				)
								elif self.__height == 1:
														return self.__matrix[0][0]
								elif self.__height == 2:
														return (
														    self.__matrix[0][0] * self.__matrix[1][1]
														    - self.__matrix[0][1] * self.__matrix[1][0]
														)
								else:
														SCREAMING_SNAKE_CASE													=					[
														    self.__matrix[0][y] * self.cofactor(0						,       lowerCAmelCase__				) for y in range(self.__width				)
														]
														return sum(lowerCAmelCase__				)





def     lowercase			(SCREAMING_SNAKE_CASE_		:				int  )   ->						Matrix:
						SCREAMING_SNAKE_CASE													=					[[0] * n for _ in range(SCREAMING_SNAKE_CASE_  )]
						return Matrix(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )


def     lowercase			(SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int ,			SCREAMING_SNAKE_CASE_		:				int  )   ->						Matrix:
						random.seed(SCREAMING_SNAKE_CASE_  )
						SCREAMING_SNAKE_CASE													=					[
						    [random.randint(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  ) for _ in range(SCREAMING_SNAKE_CASE_  )] for _ in range(SCREAMING_SNAKE_CASE_  )
						]
						return Matrix(SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_ ,			SCREAMING_SNAKE_CASE_  )


