'''simple docstring'''


import os
import tempfile
from functools import partial
from unittest import TestCase
from unittest.mock import patch

import numpy as np
import pytest

from datasets.arrow_dataset import Dataset
from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex

from .utils import require_elasticsearch, require_faiss


__lowerCAmelCase	:       Any						       =	pytest.mark.integration






@require_faiss
class 						A   (   UpperCAmelCase   ):





							def       snake_case__						(      self				:							Dict	)							->	Dict:
								__UpperCAmelCase							=			Dataset.from_dict({'''filename''': ['''my_name-train''' + '''_''' + str(__a	) for x in np.arange(3_0	).tolist()]}	)
								return dset





							def       snake_case__						(      self				:							str	)							->	int:
								import faiss

								__UpperCAmelCase							=			self._create_dummy_dataset()
								__UpperCAmelCase							=			dset.map(
								    lambda __a     ,		__a	: {"vecs": i * np.ones(5     ,		dtype=np.floataa	)}     ,		with_indices=__a     ,		keep_in_memory=__a	)
								__UpperCAmelCase							=			dset.add_faiss_index('''vecs'''     ,		batch_size=1_0_0     ,		metric_type=faiss.METRIC_INNER_PRODUCT	)
								__UpperCAmelCase				,			__UpperCAmelCase							=			dset.get_nearest_examples('''vecs'''     ,		np.ones(5     ,		dtype=np.floataa	)	)
								self.assertEqual(examples['''filename'''][0]     ,		'''my_name-train_29'''	)
								dset.drop_index('''vecs'''	)





							def       snake_case__						(      self				:							Any	)							->	List[Any]:
								import faiss

								__UpperCAmelCase							=			self._create_dummy_dataset()
								dset.add_faiss_index_from_external_arrays(
								    external_arrays=np.ones((3_0, 5)	) * np.arange(3_0	).reshape(-1     ,		1	)     ,		index_name='''vecs'''     ,		batch_size=1_0_0     ,		metric_type=faiss.METRIC_INNER_PRODUCT     ,		)
								__UpperCAmelCase				,			__UpperCAmelCase							=			dset.get_nearest_examples('''vecs'''     ,		np.ones(5     ,		dtype=np.floataa	)	)
								self.assertEqual(examples['''filename'''][0]     ,		'''my_name-train_29'''	)





							def       snake_case__						(      self				:							Optional[Any]	)							->	Optional[int]:
								import faiss

								__UpperCAmelCase							=			self._create_dummy_dataset()
								dset.add_faiss_index_from_external_arrays(
								    external_arrays=np.ones((3_0, 5)	) * np.arange(3_0	).reshape(-1     ,		1	)     ,		index_name='''vecs'''     ,		metric_type=faiss.METRIC_INNER_PRODUCT     ,		)

								# Setting delete=False and unlinking manually is not pretty... but it is required on Windows to
								# ensure somewhat stable behaviour. If we don't, we get PermissionErrors. This is an age-old issue.
								# see https://bugs.python.org/issue14243 and
								# https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file/23212515
								with tempfile.NamedTemporaryFile(delete=__a	) as tmp_file:
									dset.save_faiss_index('''vecs'''     ,		tmp_file.name	)
									dset.load_faiss_index('''vecs2'''     ,		tmp_file.name	)
								os.unlink(tmp_file.name	)

								__UpperCAmelCase				,			__UpperCAmelCase							=			dset.get_nearest_examples('''vecs2'''     ,		np.ones(5     ,		dtype=np.floataa	)	)
								self.assertEqual(examples['''filename'''][0]     ,		'''my_name-train_29'''	)





							def       snake_case__						(      self				:							Dict	)							->	List[str]:
								__UpperCAmelCase							=			self._create_dummy_dataset()
								dset.add_faiss_index_from_external_arrays(
								    external_arrays=np.ones((3_0, 5)	) * np.arange(3_0	).reshape(-1     ,		1	)     ,		index_name='''vecs'''	)
								dset.drop_index('''vecs'''	)
								self.assertRaises(__a     ,		partial(dset.get_nearest_examples     ,		'''vecs2'''     ,		np.ones(5     ,		dtype=np.floataa	)	)	)






							def       snake_case__						(      self				:							Optional[Any]	)							->	Optional[int]:
								from elasticsearch import Elasticsearch

								__UpperCAmelCase							=			self._create_dummy_dataset()
								with patch('''elasticsearch.Elasticsearch.search'''	) as mocked_search, patch(
								    '''elasticsearch.client.IndicesClient.create'''	) as mocked_index_create, patch('''elasticsearch.helpers.streaming_bulk'''	) as mocked_bulk:
									__UpperCAmelCase							=			{'''acknowledged''': True}
									mocked_bulk.return_value([(True, None)] * 3_0	)
									__UpperCAmelCase							=			{'''hits''': {'''hits''': [{'''_score''': 1, '''_id''': 2_9}]}}
									__UpperCAmelCase							=			Elasticsearch()

									dset.add_elasticsearch_index('''filename'''     ,		es_client=__a	)
									__UpperCAmelCase				,			__UpperCAmelCase							=			dset.get_nearest_examples('''filename'''     ,		'''my_name-train_29'''	)
									self.assertEqual(examples['''filename'''][0]     ,		'''my_name-train_29'''	)






@require_faiss
class 						A   (   UpperCAmelCase   ):





							def       snake_case__						(      self				:							Union[str, Any]	)							->	Dict:
								import faiss

								__UpperCAmelCase							=			FaissIndex(metric_type=faiss.METRIC_INNER_PRODUCT	)

								# add vectors
								index.add_vectors(np.eye(5     ,		dtype=np.floataa	)	)
								self.assertIsNotNone(index.faiss_index	)
								self.assertEqual(index.faiss_index.ntotal     ,		5	)
								index.add_vectors(np.zeros((5, 5)     ,		dtype=np.floataa	)	)
								self.assertEqual(index.faiss_index.ntotal     ,		1_0	)

								# single query
								__UpperCAmelCase							=			np.zeros(5     ,		dtype=np.floataa	)
								__UpperCAmelCase							=			1
								__UpperCAmelCase				,			__UpperCAmelCase							=			index.search(__a	)
								self.assertRaises(__a     ,		index.search     ,		query.reshape(-1     ,		1	)	)
								self.assertGreater(scores[0]     ,		0	)
								self.assertEqual(indices[0]     ,		1	)

								# batched queries
								__UpperCAmelCase							=			np.eye(5     ,		dtype=np.floataa	)[::-1]
								__UpperCAmelCase				,			__UpperCAmelCase							=			index.search_batch(__a	)
								self.assertRaises(__a     ,		index.search_batch     ,		queries[0]	)
								__UpperCAmelCase							=			[scores[0] for scores in total_scores]
								__UpperCAmelCase							=			[indices[0] for indices in total_indices]
								self.assertGreater(np.min(__a	)     ,		0	)
								self.assertListEqual([4, 3, 2, 1, 0]     ,		__a	)





							def       snake_case__						(      self				:							int	)							->	int:
								import faiss

								__UpperCAmelCase							=			FaissIndex(string_factory='''Flat'''	)
								index.add_vectors(np.eye(5     ,		dtype=np.floataa	)	)
								self.assertIsInstance(index.faiss_index     ,		faiss.IndexFlat	)
								__UpperCAmelCase							=			FaissIndex(string_factory='''LSH'''	)
								index.add_vectors(np.eye(5     ,		dtype=np.floataa	)	)
								self.assertIsInstance(index.faiss_index     ,		faiss.IndexLSH	)
								with self.assertRaises(__a	):
									__UpperCAmelCase							=			FaissIndex(string_factory='''Flat'''     ,		custom_index=faiss.IndexFlat(5	)	)





							def       snake_case__						(      self				:							List[Any]	)							->	str:
								import faiss

								__UpperCAmelCase							=			faiss.IndexFlat(5	)
								__UpperCAmelCase							=			FaissIndex(custom_index=__a	)
								index.add_vectors(np.eye(5     ,		dtype=np.floataa	)	)
								self.assertIsInstance(index.faiss_index     ,		faiss.IndexFlat	)






							def       snake_case__						(      self				:							int	)							->	Any:
								import faiss

								__UpperCAmelCase							=			FaissIndex(metric_type=faiss.METRIC_INNER_PRODUCT	)
								index.add_vectors(np.eye(5     ,		dtype=np.floataa	)	)

								# Setting delete=False and unlinking manually is not pretty... but it is required on Windows to
								# ensure somewhat stable behaviour. If we don't, we get PermissionErrors. This is an age-old issue.
								# see https://bugs.python.org/issue14243 and
								# https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file/23212515
								with tempfile.NamedTemporaryFile(delete=__a	) as tmp_file:
									index.save(tmp_file.name	)
									__UpperCAmelCase							=			FaissIndex.load(tmp_file.name	)
								os.unlink(tmp_file.name	)

								__UpperCAmelCase							=			np.zeros(5     ,		dtype=np.floataa	)
								__UpperCAmelCase							=			1
								__UpperCAmelCase				,			__UpperCAmelCase							=			index.search(__a	)
								self.assertGreater(scores[0]     ,		0	)
								self.assertEqual(indices[0]     ,		1	)





@require_faiss
def       lowerCAmelCase					(		UpperCamelCase__				:   Tuple       ):


	"""simple docstring"""
	import faiss

	__UpperCAmelCase							=			FaissIndex(metric_type=faiss.METRIC_INNER_PRODUCT       )
	index.add_vectors(np.eye(5    ,					dtype=np.floataa       )       )

	__UpperCAmelCase							=			'''index.faiss'''
	__UpperCAmelCase							=			f"""mock://{index_name}"""
	index.save(UpperCamelCase__    ,					storage_options=mockfs.storage_options       )
	__UpperCAmelCase							=			FaissIndex.load(UpperCamelCase__    ,					storage_options=mockfs.storage_options       )

	__UpperCAmelCase							=			np.zeros(5    ,					dtype=np.floataa       )
	__UpperCAmelCase							=			1
	__UpperCAmelCase				,			__UpperCAmelCase							=			index.search(UpperCamelCase__       )
	assert scores[0] > 0
	assert indices[0] == 1






@require_elasticsearch
class 						A   (   UpperCAmelCase   ):





							def       snake_case__						(      self				:							Union[str, Any]	)							->	str:
								from elasticsearch import Elasticsearch

								with patch('''elasticsearch.Elasticsearch.search'''	) as mocked_search, patch(
								    '''elasticsearch.client.IndicesClient.create'''	) as mocked_index_create, patch('''elasticsearch.helpers.streaming_bulk'''	) as mocked_bulk:
									__UpperCAmelCase							=			Elasticsearch()
									__UpperCAmelCase							=			{'''acknowledged''': True}
									__UpperCAmelCase							=			ElasticSearchIndex(es_client=__a	)
									mocked_bulk.return_value([(True, None)] * 3	)
									index.add_documents(['''foo''', '''bar''', '''foobar''']	)

									# single query
									__UpperCAmelCase							=			'''foo'''
									__UpperCAmelCase							=			{'''hits''': {'''hits''': [{'''_score''': 1, '''_id''': 0}]}}
									__UpperCAmelCase				,			__UpperCAmelCase							=			index.search(__a	)
									self.assertEqual(scores[0]     ,		1	)
									self.assertEqual(indices[0]     ,		0	)

									# single query with timeout
									__UpperCAmelCase							=			'''foo'''
									__UpperCAmelCase							=			{'''hits''': {'''hits''': [{'''_score''': 1, '''_id''': 0}]}}
									__UpperCAmelCase				,			__UpperCAmelCase							=			index.search(__a     ,		request_timeout=3_0	)
									self.assertEqual(scores[0]     ,		1	)
									self.assertEqual(indices[0]     ,		0	)

									# batched queries
									__UpperCAmelCase							=			['''foo''', '''bar''', '''foobar''']
									__UpperCAmelCase							=			{'''hits''': {'''hits''': [{'''_score''': 1, '''_id''': 1}]}}
									__UpperCAmelCase				,			__UpperCAmelCase							=			index.search_batch(__a	)
									__UpperCAmelCase							=			[scores[0] for scores in total_scores]
									__UpperCAmelCase							=			[indices[0] for indices in total_indices]
									self.assertGreater(np.min(__a	)     ,		0	)
									self.assertListEqual([1, 1, 1]     ,		__a	)

									# batched queries with timeout
									__UpperCAmelCase							=			['''foo''', '''bar''', '''foobar''']
									__UpperCAmelCase							=			{'''hits''': {'''hits''': [{'''_score''': 1, '''_id''': 1}]}}
									__UpperCAmelCase				,			__UpperCAmelCase							=			index.search_batch(__a     ,		request_timeout=3_0	)
									__UpperCAmelCase							=			[scores[0] for scores in total_scores]
									__UpperCAmelCase							=			[indices[0] for indices in total_indices]
									self.assertGreater(np.min(__a	)     ,		0	)
									self.assertListEqual([1, 1, 1]     ,		__a	)

'''simple docstring'''


from __future__ import annotations

import unittest

from transformers import DistilBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

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


if is_tf_available():
					import tensorflow as tf

					from transformers.models.distilbert.modeling_tf_distilbert import (
					    TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
					    TFDistilBertForMaskedLM,
					    TFDistilBertForMultipleChoice,
					    TFDistilBertForQuestionAnswering,
					    TFDistilBertForSequenceClassification,
					    TFDistilBertForTokenClassification,
					    TFDistilBertModel,
					)






class 						A   :





							def __init__(      self				:							List[Any]     ,		__a				:							Any     ,		)							->	Dict:
								__UpperCAmelCase							=			parent
								__UpperCAmelCase							=			1_3
								__UpperCAmelCase							=			7
								__UpperCAmelCase							=			True
								__UpperCAmelCase							=			True
								__UpperCAmelCase							=			False
								__UpperCAmelCase							=			True
								__UpperCAmelCase							=			9_9
								__UpperCAmelCase							=			3_2
								__UpperCAmelCase							=			2
								__UpperCAmelCase							=			4
								__UpperCAmelCase							=			3_7
								__UpperCAmelCase							=			'''gelu'''
								__UpperCAmelCase							=			0.1
								__UpperCAmelCase							=			0.1
								__UpperCAmelCase							=			5_1_2
								__UpperCAmelCase							=			1_6
								__UpperCAmelCase							=			2
								__UpperCAmelCase							=			0.0_2
								__UpperCAmelCase							=			3
								__UpperCAmelCase							=			4
								__UpperCAmelCase							=			None





							def       snake_case__						(      self				:							Optional[int]	)							->	Dict:
								__UpperCAmelCase							=			ids_tensor([self.batch_size, self.seq_length]     ,		self.vocab_size	)

								__UpperCAmelCase							=			None
								if self.use_input_mask:
									__UpperCAmelCase							=			random_attention_mask([self.batch_size, self.seq_length]	)

								__UpperCAmelCase							=			None
								__UpperCAmelCase							=			None
								__UpperCAmelCase							=			None
								if self.use_labels:
									__UpperCAmelCase							=			ids_tensor([self.batch_size]     ,		self.type_sequence_label_size	)
									__UpperCAmelCase							=			ids_tensor([self.batch_size, self.seq_length]     ,		self.num_labels	)
									__UpperCAmelCase							=			ids_tensor([self.batch_size]     ,		self.num_choices	)

								__UpperCAmelCase							=			DistilBertConfig(
								    vocab_size=self.vocab_size     ,		dim=self.hidden_size     ,		n_layers=self.num_hidden_layers     ,		n_heads=self.num_attention_heads     ,		hidden_dim=self.intermediate_size     ,		hidden_act=self.hidden_act     ,		dropout=self.hidden_dropout_prob     ,		attention_dropout=self.attention_probs_dropout_prob     ,		max_position_embeddings=self.max_position_embeddings     ,		initializer_range=self.initializer_range     ,		)

								return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels





							def       snake_case__						(      self				:							Union[str, Any]     ,		__a				:							List[str]     ,		__a				:							int     ,		__a				:							Union[str, Any]     ,		__a				:							Union[str, Any]     ,		__a				:							List[Any]     ,		__a				:							int	)							->	Any:
								__UpperCAmelCase							=			TFDistilBertModel(config=__a	)
								__UpperCAmelCase							=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}

								__UpperCAmelCase							=			model(__a	)

								__UpperCAmelCase							=			[input_ids, input_mask]

								__UpperCAmelCase							=			model(__a	)

								self.parent.assertEqual(result.last_hidden_state.shape     ,		(self.batch_size, self.seq_length, self.hidden_size)	)





							def       snake_case__						(      self				:							Tuple     ,		__a				:							List[Any]     ,		__a				:							int     ,		__a				:							Tuple     ,		__a				:							List[Any]     ,		__a				:							Union[str, Any]     ,		__a				:							List[Any]	)							->	int:
								__UpperCAmelCase							=			TFDistilBertForMaskedLM(config=__a	)
								__UpperCAmelCase							=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
								__UpperCAmelCase							=			model(__a	)
								self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.seq_length, self.vocab_size)	)





							def       snake_case__						(      self				:							Optional[int]     ,		__a				:							Any     ,		__a				:							Union[str, Any]     ,		__a				:							Optional[int]     ,		__a				:							int     ,		__a				:							Optional[Any]     ,		__a				:							Optional[int]	)							->	Dict:
								__UpperCAmelCase							=			TFDistilBertForQuestionAnswering(config=__a	)
								__UpperCAmelCase							=			{
								    '''input_ids''': input_ids,
								    '''attention_mask''': input_mask,
								}
								__UpperCAmelCase							=			model(__a	)
								self.parent.assertEqual(result.start_logits.shape     ,		(self.batch_size, self.seq_length)	)
								self.parent.assertEqual(result.end_logits.shape     ,		(self.batch_size, self.seq_length)	)





							def       snake_case__						(      self				:							Any     ,		__a				:							Optional[Any]     ,		__a				:							List[str]     ,		__a				:							Dict     ,		__a				:							Dict     ,		__a				:							int     ,		__a				:							List[Any]	)							->	Dict:
								__UpperCAmelCase							=			self.num_labels
								__UpperCAmelCase							=			TFDistilBertForSequenceClassification(__a	)
								__UpperCAmelCase							=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
								__UpperCAmelCase							=			model(__a	)
								self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.num_labels)	)





							def       snake_case__						(      self				:							Union[str, Any]     ,		__a				:							int     ,		__a				:							str     ,		__a				:							Union[str, Any]     ,		__a				:							Optional[int]     ,		__a				:							List[str]     ,		__a				:							Dict	)							->	str:
								__UpperCAmelCase							=			self.num_choices
								__UpperCAmelCase							=			TFDistilBertForMultipleChoice(__a	)
								__UpperCAmelCase							=			tf.tile(tf.expand_dims(__a     ,		1	)     ,		(1, self.num_choices, 1)	)
								__UpperCAmelCase							=			tf.tile(tf.expand_dims(__a     ,		1	)     ,		(1, self.num_choices, 1)	)
								__UpperCAmelCase							=			{
								    '''input_ids''': multiple_choice_inputs_ids,
								    '''attention_mask''': multiple_choice_input_mask,
								}
								__UpperCAmelCase							=			model(__a	)
								self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.num_choices)	)





							def       snake_case__						(      self				:							int     ,		__a				:							Optional[Any]     ,		__a				:							int     ,		__a				:							Tuple     ,		__a				:							int     ,		__a				:							Optional[int]     ,		__a				:							Optional[int]	)							->	int:
								__UpperCAmelCase							=			self.num_labels
								__UpperCAmelCase							=			TFDistilBertForTokenClassification(__a	)
								__UpperCAmelCase							=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
								__UpperCAmelCase							=			model(__a	)
								self.parent.assertEqual(result.logits.shape     ,		(self.batch_size, self.seq_length, self.num_labels)	)






							def       snake_case__						(      self				:							str	)							->	Any:
								__UpperCAmelCase							=			self.prepare_config_and_inputs()
								((__UpperCAmelCase)				,			(__UpperCAmelCase)				,			(__UpperCAmelCase)				,			(__UpperCAmelCase)				,			(__UpperCAmelCase)				,			(__UpperCAmelCase))							=			config_and_inputs
								__UpperCAmelCase							=			{'''input_ids''': input_ids, '''attention_mask''': input_mask}
								return config, inputs_dict






@require_tf
class 						A   (   UpperCAmelCase       ,	UpperCAmelCase       ,	unittest.TestCase   ):
							a_        =      (
							    (
							        TFDistilBertModel,
							        TFDistilBertForMaskedLM,
							        TFDistilBertForQuestionAnswering,
							        TFDistilBertForSequenceClassification,
							        TFDistilBertForTokenClassification,
							        TFDistilBertForMultipleChoice,
							    )
							    if is_tf_available()
							    else None
							)
							a_        =      (
							    {
							        '''feature-extraction''': TFDistilBertModel,
							        '''fill-mask''': TFDistilBertForMaskedLM,
							        '''question-answering''': TFDistilBertForQuestionAnswering,
							        '''text-classification''': TFDistilBertForSequenceClassification,
							        '''token-classification''': TFDistilBertForTokenClassification,
							        '''zero-shot''': TFDistilBertForSequenceClassification,
							    }
							    if is_tf_available()
							    else {}
							)
							a_        =      False
							a_        =      False





							def       snake_case__						(      self				:							Any	)							->	Any:
								__UpperCAmelCase							=			TFDistilBertModelTester(self	)
								__UpperCAmelCase							=			ConfigTester(self     ,		config_class=__a     ,		dim=3_7	)





							def       snake_case__						(      self				:							List[Any]	)							->	Optional[int]:
								self.config_tester.run_common_tests()





							def       snake_case__						(      self				:							Any	)							->	str:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_model(*__a	)





							def       snake_case__						(      self				:							Tuple	)							->	Dict:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_for_masked_lm(*__a	)





							def       snake_case__						(      self				:							Union[str, Any]	)							->	Any:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_for_question_answering(*__a	)





							def       snake_case__						(      self				:							Optional[Any]	)							->	Dict:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_for_sequence_classification(*__a	)





							def       snake_case__						(      self				:							Any	)							->	int:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_for_multiple_choice(*__a	)





							def       snake_case__						(      self				:							List[str]	)							->	List[Any]:
								__UpperCAmelCase							=			self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_distilbert_for_token_classification(*__a	)






							@slow
							def       snake_case__						(      self				:							Dict	)							->	Tuple:
								for model_name in list(TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]	):
									__UpperCAmelCase							=			TFDistilBertModel.from_pretrained(__a	)
									self.assertIsNotNone(__a	)






@require_tf
class 						A   (   unittest.TestCase   ):





							@slow
							def       snake_case__						(      self				:							int	)							->	Dict:
								__UpperCAmelCase							=			TFDistilBertModel.from_pretrained('''distilbert-base-uncased'''	)
								__UpperCAmelCase							=			tf.constant([[0, 1, 2, 3, 4, 5]]	)
								__UpperCAmelCase							=			model(__a	)[0]

								__UpperCAmelCase							=			[1, 6, 7_6_8]
								self.assertEqual(output.shape     ,		__a	)

								__UpperCAmelCase							=			tf.constant(
								    [
								        [
								            [0.1_9_2_6_1_8_8_5, -0.1_3_7_3_2_9_5_5, 0.4_1_1_9_7_9_9],
								            [0.2_2_1_5_0_1_5_6, -0.0_7_4_2_2_6_6_1, 0.3_9_0_3_7_2_0_4],
								            [0.2_2_7_5_6_0_1_8, -0.0_8_9_6_4_1_4, 0.3_7_0_1_4_6_7],
								        ]
								    ]	)
								tf.debugging.assert_near(output[:, :3, :3]     ,		__a     ,		atol=1e-4	)
