

import json
import os
from functools import lru_cache
from typing import TYPE_CHECKING, List, Optional, Tuple

import regex as re

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging


if TYPE_CHECKING:
 from transformers.pipelines.conversational import Conversation

_UpperCamelCase					     =						logging.get_logger(__name__)


_UpperCamelCase					     =						{
    "vocab_file": "vocab.json",
    "merges_file": "merges.txt",
    "tokenizer_config_file": "tokenizer_config.json",
}

_UpperCamelCase					     =						{
    "vocab_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/vocab.json"},
    "merges_file": {"facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/merges.txt"},
    "tokenizer_config_file": {
        "facebook/blenderbot-3B": "https://huggingface.co/facebook/blenderbot-3B/resolve/main/tokenizer_config.json"
    },
}

_UpperCamelCase					     =						{"facebook/blenderbot-3B": 128}







@lru_cache()
# Copied from transformers.models.roberta.tokenization_roberta.bytes_to_unicode
def 						_lowercase					(	):
      __lowerCAmelCase   :		List[str]   =   (
          list(range(ord('''!'''		)  ,      ord('''~'''		) + 1		)		) + list(range(ord('''¡'''		)  ,      ord('''¬'''		) + 1		)		) + list(range(ord('''®'''		)  ,      ord('''ÿ'''		) + 1		)		)
      )
      __lowerCAmelCase   :		Optional[Any]   =   bs[:]
      __lowerCAmelCase   :		Optional[Any]   =   0
      for b in range(2**8		):
            if b not in bs:
                  bs.append(_SCREAMING_SNAKE_CASE		)
                  cs.append(2**8 + n		)
                  n += 1
      __lowerCAmelCase   :		Tuple   =   [chr(_SCREAMING_SNAKE_CASE		) for n in cs]
      return dict(zip(_SCREAMING_SNAKE_CASE  ,      _SCREAMING_SNAKE_CASE		)		)







def 						_lowercase					(	lowercase__		):
      __lowerCAmelCase   :		int   =   set()
      __lowerCAmelCase   :		Optional[int]   =   word[0]
      for char in word[1:]:
            pairs.add((prev_char, char)		)
            __lowerCAmelCase   :		List[str]   =   char
      return pairs







class     __lowercase (__snake_case					):
 _UpperCamelCase         =    VOCAB_FILES_NAMES
 _UpperCamelCase         =    PRETRAINED_VOCAB_FILES_MAP
 _UpperCamelCase         =    PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 _UpperCamelCase         =    ["""input_ids""", """attention_mask"""]
 def __init__(				self ,				A_ ,				A_ ,				A_="replace" ,				A_="<s>" ,				A_="</s>" ,				A_="</s>" ,				A_="<s>" ,				A_="<unk>" ,				A_="<pad>" ,				A_="<mask>" ,				A_=False ,				**A_ ,				)   ->Dict:



       '''simple docstring'''





       __lowerCAmelCase   :		str   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else bos_token
       __lowerCAmelCase   :		Optional[int]   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else eos_token
       __lowerCAmelCase   :		Optional[int]   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else sep_token
       __lowerCAmelCase   :		Any   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else cls_token
       __lowerCAmelCase   :		Union[str, Any]   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else unk_token
       __lowerCAmelCase   :		Tuple   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else pad_token

       # Mask token behave like a normal word, i.e. include the space before it
       __lowerCAmelCase   :		Union[str, Any]   =   AddedToken(snake_case_ ,				lstrip=snake_case_ ,				rstrip=snake_case_   ) if isinstance(snake_case_ ,				snake_case_   ) else mask_token

       super().__init__(
           errors=snake_case_ ,				bos_token=snake_case_ ,				eos_token=snake_case_ ,				unk_token=snake_case_ ,				sep_token=snake_case_ ,				cls_token=snake_case_ ,				pad_token=snake_case_ ,				mask_token=snake_case_ ,				add_prefix_space=snake_case_ ,				**snake_case_ ,				)

       with open(snake_case_ ,				encoding='''utf-8'''   ) as vocab_handle:
             __lowerCAmelCase   :		List[Any]   =   json.load(snake_case_   )
       __lowerCAmelCase   :		Union[str, Any]   =   {v: k for k, v in self.encoder.items()}
       __lowerCAmelCase   :		int   =   errors  # how to handle errors in decoding
       __lowerCAmelCase   :		Optional[int]   =   bytes_to_unicode()
       __lowerCAmelCase   :		Any   =   {v: k for k, v in self.byte_encoder.items()}
       with open(snake_case_ ,				encoding='''utf-8'''   ) as merges_handle:
             __lowerCAmelCase   :		Union[str, Any]   =   merges_handle.read().split('''\n'''   )[1:-1]
       __lowerCAmelCase   :		Tuple   =   [tuple(merge.split()   ) for merge in bpe_merges]
       __lowerCAmelCase   :		int   =   dict(zip(snake_case_ ,				range(len(snake_case_   )   )   )   )
       __lowerCAmelCase   :		str   =   {}
       __lowerCAmelCase   :		List[Any]   =   add_prefix_space

       # Should have added re.IGNORECASE so BPE merges can happen for capitalized versions of contractions
       __lowerCAmelCase   :		List[Any]   =   re.compile(R'''\'s|\'t|\'re|\'ve|\'m|\'ll|\'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+'''   )
 @property
 # Copied from transformers.models.roberta.tokenization_roberta.RobertaTokenizer.vocab_size with Roberta->Blenderbot, RoBERTa->Blenderbot
 def       UpperCamelCase__    (				self   )   ->Optional[Any]:



       '''simple docstring'''





       return len(self.encoder   )
 def       UpperCamelCase__    (				self   )   ->int:



       '''simple docstring'''





       return dict(self.encoder ,				**self.added_tokens_encoder   )
 def       UpperCamelCase__    (				self ,				A_   )   ->Optional[int]:



       '''simple docstring'''





       if token in self.cache:
             return self.cache[token]
       __lowerCAmelCase   :		Optional[int]   =   tuple(snake_case_   )
       __lowerCAmelCase   :		List[Any]   =   get_pairs(snake_case_   )

       if not pairs:
             return token

       while True:
             __lowerCAmelCase   :		Dict   =   min(snake_case_ ,				key=lambda A_   : self.bpe_ranks.get(snake_case_ ,				float('''inf'''   )   )   )
             if bigram not in self.bpe_ranks:
                   break
             __lowerCAmelCase,				__lowerCAmelCase   :		Optional[int]   =   bigram
             __lowerCAmelCase   :		List[Any]   =   []
             __lowerCAmelCase   :		str   =   0
             while i < len(snake_case_   ):
                   try:
                         __lowerCAmelCase   :		Tuple   =   word.index(snake_case_ ,				snake_case_   )
                   except ValueError:
                         new_word.extend(word[i:]   )
                         break
                   else:
                         new_word.extend(word[i:j]   )
                         __lowerCAmelCase   :		Tuple   =   j

                   if word[i] == first and i < len(snake_case_   ) - 1 and word[i + 1] == second:
                         new_word.append(first + second   )
                         i += 2
                   else:
                         new_word.append(word[i]   )
                         i += 1
             __lowerCAmelCase   :		Optional[int]   =   tuple(snake_case_   )
             __lowerCAmelCase   :		Optional[Any]   =   new_word
             if len(snake_case_   ) == 1:
                   break
             else:
                   __lowerCAmelCase   :		int   =   get_pairs(snake_case_   )
       __lowerCAmelCase   :		Tuple   =   ''' '''.join(snake_case_   )
       __lowerCAmelCase   :		Union[str, Any]   =   word
       return word
 def       UpperCamelCase__    (				self ,				A_   )   ->Tuple:



       '''simple docstring'''





       __lowerCAmelCase   :		Any   =   []
       for token in re.findall(self.pat ,				snake_case_   ):
             __lowerCAmelCase   :		List[Any]   =   ''''''.join(
                 self.byte_encoder[b] for b in token.encode('''utf-8'''   )   )  # Maps all our bytes to unicode strings, avoiding control tokens of the BPE (spaces in our case)
             bpe_tokens.extend(bpe_token for bpe_token in self.bpe(snake_case_   ).split(''' '''   )   )
       return bpe_tokens
 def       UpperCamelCase__    (				self ,				A_   )   ->List[Any]:



       '''simple docstring'''





       return self.encoder.get(snake_case_ ,				self.encoder.get(self.unk_token   )   )
 def       UpperCamelCase__    (				self ,				A_   )   ->Optional[int]:



       '''simple docstring'''





       return self.decoder.get(snake_case_   )
 def       UpperCamelCase__    (				self ,				A_   )   ->str:



       '''simple docstring'''





       __lowerCAmelCase   :		Tuple   =   ''''''.join(snake_case_   )
       __lowerCAmelCase   :		Optional[Any]   =   bytearray([self.byte_decoder[c] for c in text]   ).decode('''utf-8''' ,				errors=self.errors   )
       return text
 def       UpperCamelCase__    (				self ,				A_ ,				A_ = None   )   ->Dict:



       '''simple docstring'''





       if not os.path.isdir(snake_case_   ):
             logger.error(f"""Vocabulary path ({save_directory}) should be a directory"""   )
             return
       __lowerCAmelCase   :		Optional[Any]   =   os.path.join(
           snake_case_ ,				(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''vocab_file''']   )
       __lowerCAmelCase   :		Dict   =   os.path.join(
           snake_case_ ,				(filename_prefix + '''-''' if filename_prefix else '''''') + VOCAB_FILES_NAMES['''merges_file''']   )

       with open(snake_case_ ,				'''w''' ,				encoding='''utf-8'''   ) as f:
             f.write(json.dumps(self.encoder ,				indent=2 ,				sort_keys=snake_case_ ,				ensure_ascii=snake_case_   ) + '''\n'''   )

       __lowerCAmelCase   :		int   =   0
       with open(snake_case_ ,				'''w''' ,				encoding='''utf-8'''   ) as writer:
             writer.write('''#version: 0.2\n'''   )
             for bpe_tokens, token_index in sorted(self.bpe_ranks.items() ,				key=lambda A_   : kv[1]   ):
                   if index != token_index:
                         logger.warning(
                             f"""Saving vocabulary to {merge_file}: BPE merge indices are not consecutive."""
                             ''' Please check that the tokenizer is not corrupted!'''   )
                         __lowerCAmelCase   :		Union[str, Any]   =   token_index
                   writer.write(''' '''.join(snake_case_   ) + '''\n'''   )
                   index += 1

       return vocab_file, merge_file
 def       UpperCamelCase__    (				self ,				A_ ,				A_ = None ,				A_ = False   )   ->int:



       '''simple docstring'''





       if already_has_special_tokens:
             return super().get_special_tokens_mask(
                 token_ids_a=snake_case_ ,				token_ids_a=snake_case_ ,				already_has_special_tokens=snake_case_   )

       if token_ids_a is None:
             return [1] + ([0] * len(snake_case_   )) + [1]
       return [1] + ([0] * len(snake_case_   )) + [1, 1] + ([0] * len(snake_case_   )) + [1]
 def       UpperCamelCase__    (				self ,				A_ ,				A_ = None   )   ->List[str]:



       '''simple docstring'''





       __lowerCAmelCase   :		Union[str, Any]   =   [self.sep_token_id]
       __lowerCAmelCase   :		List[str]   =   [self.cls_token_id]

       if token_ids_a is None:
             return len(cls + token_ids_a + sep   ) * [0]
       return len(cls + token_ids_a + sep + sep + token_ids_a + sep   ) * [0]
 def       UpperCamelCase__    (				self ,				A_ ,				A_=False ,				**A_   )   ->Tuple:



       '''simple docstring'''





       __lowerCAmelCase   :		str   =   kwargs.pop('''add_prefix_space''' ,				self.add_prefix_space   )
       if (is_split_into_words or add_prefix_space) and (len(snake_case_   ) > 0 and not text[0].isspace()):
             __lowerCAmelCase   :		Optional[int]   =   ''' ''' + text
       return (text, kwargs)
 def       UpperCamelCase__    (				self ,				A_ ,				A_ = None   )   ->List[Any]:



       '''simple docstring'''





       return token_ids_a + [self.eos_token_id]





 def       UpperCamelCase__    (				self ,				A_   )   ->List[Any]:



       '''simple docstring'''





       __lowerCAmelCase   :		Any   =   []
       for is_user, text in conversation.iter_texts():
             if is_user:
                   # We need to space prefix as it's being done within blenderbot
                   inputs.append(''' ''' + text   )
             else:
                   # Generated responses should contain them already.
                   inputs.append(snake_case_   )

       __lowerCAmelCase   :		Any   =   '''  '''.join(snake_case_   )
       __lowerCAmelCase   :		int   =   self.encode(snake_case_   )
       if len(snake_case_   ) > self.model_max_length:
             __lowerCAmelCase   :		Optional[int]   =   input_ids[-self.model_max_length :]
             logger.warning(f"""Trimmed input from conversation as it was longer than {self.model_max_length} tokens."""   )
       return input_ids









from __future__ import annotations

import unittest

from transformers import EsmConfig, is_tf_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, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
 import numpy
 import tensorflow as tf

 from transformers.models.esm.modeling_tf_esm import (
     TF_ESM_PRETRAINED_MODEL_ARCHIVE_LIST,
     TFEsmForMaskedLM,
     TFEsmForSequenceClassification,
     TFEsmForTokenClassification,
     TFEsmModel,
 )







class      lowerCamelCase:
     '''simple docstring'''


     def __init__(    self				,     snake_case_				,     ):
         _A     =							parent
         _A     =							13
         _A     =							7
         _A     =							True
         _A     =							True
         _A     =							True
         _A     =							99
         _A     =							32
         _A     =							2
         _A     =							4
         _A     =							37
         _A     =							'gelu'
         _A     =							0.1
         _A     =							0.1
         _A     =							512
         _A     =							16
         _A     =							2
         _A     =							0.02
         _A     =							3
         _A     =							4
         _A     =							None




     def        lowerCAmelCase__		(    self							):
         _A     =							ids_tensor([self.batch_size, self.seq_length]				,     self.vocab_size							)

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

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

         _A     =							EsmConfig(
             vocab_size=self.vocab_size				,     hidden_size=self.hidden_size				,     num_hidden_layers=self.num_hidden_layers				,     pad_token_id=1				,     num_attention_heads=self.num_attention_heads				,     intermediate_size=self.intermediate_size				,     hidden_act=self.hidden_act				,     hidden_dropout_prob=self.hidden_dropout_prob				,     attention_probs_dropout_prob=self.attention_probs_dropout_prob				,     max_position_embeddings=self.max_position_embeddings				,     type_vocab_size=self.type_vocab_size				,     initializer_range=self.initializer_range				,     )

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




     def        lowerCAmelCase__		(    self							):
         (
             (
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			
         )     =							self.prepare_config_and_inputs()

         _A     =							True
         _A     =							floats_tensor([self.batch_size, self.seq_length, self.hidden_size]							)
         _A     =							ids_tensor([self.batch_size, self.seq_length]				,     vocab_size=2							)

         return (
             config,
             input_ids,
             input_mask,
             sequence_labels,
             token_labels,
             choice_labels,
             encoder_hidden_states,
             encoder_attention_mask,
         )




     def        lowerCAmelCase__		(    self				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_							):
         _A     =							TFEsmModel(config=snake_case_							)
         _A     =							{'input_ids': input_ids, 'attention_mask': input_mask}
         _A     =							model(snake_case_							)

         _A     =							[input_ids, input_mask]
         _A     =							model(snake_case_							)

         _A     =							model(snake_case_							)

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




     def        lowerCAmelCase__		(    self				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     ):
         _A     =							True

         _A     =							TFEsmModel(config=snake_case_							)
         _A     =							{
             'input_ids': input_ids,
             'attention_mask': input_mask,
             'encoder_hidden_states': encoder_hidden_states,
             'encoder_attention_mask': encoder_attention_mask,
         }
         _A     =							model(snake_case_							)

         _A     =							[input_ids, input_mask]
         _A     =							model(snake_case_				,     encoder_hidden_states=snake_case_							)

         # Also check the case where encoder outputs are not passed
         _A     =							model(snake_case_				,     attention_mask=snake_case_							)

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




     def        lowerCAmelCase__		(    self				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_							):
         _A     =							TFEsmForMaskedLM(config=snake_case_							)
         _A     =							model([input_ids, input_mask]							)
         self.parent.assertEqual(result.logits.shape				,     (self.batch_size, self.seq_length, self.vocab_size)							)




     def        lowerCAmelCase__		(    self				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_				,     snake_case_							):
         _A     =							self.num_labels
         _A     =							TFEsmForTokenClassification(config=snake_case_							)
         _A     =							{'input_ids': input_ids, 'attention_mask': input_mask}
         _A     =							model(snake_case_							)
         self.parent.assertEqual(result.logits.shape				,     (self.batch_size, self.seq_length, self.num_labels)							)




     def        lowerCAmelCase__		(    self							):
         _A     =							self.prepare_config_and_inputs()
         (
             (
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			(
             _A
         ),			
         )     =							config_and_inputs
         _A     =							{'input_ids': input_ids, 'attention_mask': input_mask}
         return config, inputs_dict







@require_tf
class      lowerCamelCase(						__snake_case			, __snake_case			, unittest.TestCase	):
     '''simple docstring'''


     __magic_name__   =			(
         (
             TFEsmModel,
             TFEsmForMaskedLM,
             TFEsmForSequenceClassification,
             TFEsmForTokenClassification,
         )
         if is_tf_available()
         else ()
     )
     __magic_name__   =			(
         {
             'feature-extraction': TFEsmModel,
             'fill-mask': TFEsmForMaskedLM,
             'text-classification': TFEsmForSequenceClassification,
             'token-classification': TFEsmForTokenClassification,
             'zero-shot': TFEsmForSequenceClassification,
         }
         if is_tf_available()
         else {}
     )
     __magic_name__   =			False
     __magic_name__   =			False




     def        lowerCAmelCase__		(    self							):
         _A     =							TFEsmModelTester(self							)
         _A     =							ConfigTester(self				,     config_class=snake_case_				,     hidden_size=37							)




     def        lowerCAmelCase__		(    self							):
         self.config_tester.run_common_tests()




     def        lowerCAmelCase__		(    self							):
         _A     =							self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_model(*snake_case_							)




     def        lowerCAmelCase__		(    self							):
         _A     =							self.model_tester.prepare_config_and_inputs_for_decoder()
         self.model_tester.create_and_check_model_as_decoder(*snake_case_							)




     def        lowerCAmelCase__		(    self							):
         _A     =							self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_masked_lm(*snake_case_							)




     def        lowerCAmelCase__		(    self							):
         _A     =							self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_for_token_classification(*snake_case_							)




     @slow
     def        lowerCAmelCase__		(    self							):
         for model_name in TF_ESM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
             _A     =							TFEsmModel.from_pretrained(snake_case_							)
             self.assertIsNotNone(snake_case_							)




     @unittest.skip('Protein models do not support embedding resizing.'							)
     def        lowerCAmelCase__		(    self							):
         pass




     @unittest.skip('Protein models do not support embedding resizing.'							)
     def        lowerCAmelCase__		(    self							):
         pass




     def        lowerCAmelCase__		(    self							):
         _A,			_A     =							self.model_tester.prepare_config_and_inputs_for_common()

         for model_class in self.all_model_classes:
             _A     =							model_class(snake_case_							)
             assert isinstance(model.get_input_embeddings()				,     tf.keras.layers.Layer							)
             if model_class is TFEsmForMaskedLM:
                 # Output embedding test differs from the main test because they're a matrix, not a layer
                 _A     =							model.get_bias()
                 assert isinstance(snake_case_				,     snake_case_							)
                 for k, v in name.items():
                     assert isinstance(snake_case_				,     tf.Variable							)
             else:
                 _A     =							model.get_output_embeddings()
                 assert x is None
                 _A     =							model.get_bias()
                 assert name is None







@require_tf
class      lowerCamelCase(						unittest.TestCase	):
     '''simple docstring'''


     @slow
     def        lowerCAmelCase__		(    self							):
         _A     =							TFEsmForMaskedLM.from_pretrained('facebook/esm2_t6_8M_UR50D'							)

         _A     =							tf.constant([[0, 1, 2, 3, 4, 5]]							)
         _A     =							model(snake_case_							)[0]
         _A     =							[1, 6, 33]
         self.assertEqual(list(output.numpy().shape							)				,     snake_case_							)
         # compare the actual values for a slice.
         _A     =							tf.constant(
             [
                 [
                     [8.92_1518, -10.58_9814, -6.467_1307],
                     [-6.396_7156, -13.91_1377, -1.121_1915],
                     [-7.78_1247, -13.95_1557, -3.74_0592],
                 ]
             ]							)
         self.assertTrue(numpy.allclose(output[:, :3, :3].numpy()				,     expected_slice.numpy()				,     atol=1E-2							)							)




     @slow
     def        lowerCAmelCase__		(    self							):
         _A     =							TFEsmModel.from_pretrained('facebook/esm2_t6_8M_UR50D'							)

         _A     =							tf.constant([[0, 6, 4, 13, 5, 4, 16, 12, 11, 7, 2]]							)
         _A     =							model(snake_case_							)[0]
         # compare the actual values for a slice.
         _A     =							tf.constant(
             [
                 [
                     [0.1444_3092, 0.5412_5327, 0.324_7739],
                     [0.3034_0484, 0.0052_6676, 0.3107_7722],
                     [0.3227_8043, -0.2498_7096, 0.341_4628],
                 ]
             ]							)
         self.assertTrue(numpy.allclose(output[:, :3, :3].numpy()				,     expected_slice.numpy()				,     atol=1E-4							)							)





