






import torch
from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel

class 				lowerCAmelCase_	(		a_			):
				_UpperCamelCase					:       Union[str, Any]							       = '''M-CLIP'''


				def __init__(					self ,						_lowerCAmelCase=1_0_2_4 ,						_lowerCAmelCase=7_6_8 ,						**_lowerCAmelCase      ):
											_lowercase							:   Union[str, Any] 							=   transformerDimSize
											_lowercase							:   int 							=   imageDimSize
											super().__init__(**lowerCAmelCase_      )




class 				lowerCAmelCase_	(		a_			):
				_UpperCamelCase					:       Optional[Any]							       = MCLIPConfig


				def __init__(					self ,						_lowerCAmelCase ,						*_lowerCAmelCase ,						**_lowerCAmelCase      ):
											super().__init__(lowerCAmelCase_ ,						*lowerCAmelCase_ ,						**lowerCAmelCase_      )
											_lowercase							:   str 							=   XLMRobertaModel(lowerCAmelCase_      )
											_lowercase							:   str 							=   torch.nn.Linear(
											    in_features=config.transformerDimensions ,						out_features=config.numDims      )


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase      ):
											_lowercase							:   List[Any] 							=   self.transformer(input_ids=lowerCAmelCase_ ,						attention_mask=lowerCAmelCase_      )[0]
											_lowercase							:   List[str] 							=   (embs * attention_mask.unsqueeze(2      )).sum(dim=1      ) / attention_mask.sum(dim=1      )[:, None]
											return self.LinearTransformation(lowerCAmelCase_      ), embs








'''simple docstring'''





def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int,_SCREAMING_SNAKE_CASE					: int ):






			"""simple docstring"""




			return int((input_a, input_a).count(1 ) != 0 )






def 						UpperCAmelCase__(				):






			"""simple docstring"""




			assert or_gate(0,0 ) == 0
			assert or_gate(0,1 ) == 1
			assert or_gate(1,0 ) == 1
			assert or_gate(1,1 ) == 1


if __name__ == "__main__":
					print(or_gate(0, 1))
					print(or_gate(1, 0))
					print(or_gate(0, 0))
					print(or_gate(1, 1))



