

"""simple docstring"""


import argparse
import json
import os

import fairseq
import torch
from fairseq.data import Dictionary

# Register SEW's fairseq modules
from sew_asapp import tasks  # noqa: F401

from transformers import (
    SEWConfig,
    SEWForCTC,
    SEWModel,
    WavaVecaCTCTokenizer,
    WavaVecaFeatureExtractor,
    WavaVecaProcessor,
    logging,
)


logging.set_verbosity_info()
a					:int    = logging.get_logger(__name__)

a					:Dict    = {
    "post_extract_proj": "feature_projection",
    "encoder.pos_conv.0": "encoder.pos_conv_embed.conv",
    "self_attn.k_proj": "encoder.layers.*.attention.k_proj",
    "self_attn.v_proj": "encoder.layers.*.attention.v_proj",
    "self_attn.q_proj": "encoder.layers.*.attention.q_proj",
    "self_attn.out_proj": "encoder.layers.*.attention.out_proj",
    "self_attn_layer_norm": "encoder.layers.*.layer_norm",
    "fc1": "encoder.layers.*.feed_forward.intermediate_dense",
    "fc2": "encoder.layers.*.feed_forward.output_dense",
    "final_layer_norm": "encoder.layers.*.final_layer_norm",
    "encoder.upsample.0": "encoder.upsample.projection",
    "encoder.layer_norm": "encoder.layer_norm",
    "w2v_model.layer_norm": "layer_norm",
    "w2v_encoder.proj": "lm_head",
    "mask_emb": "masked_spec_embed",
}




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)       ->				Optional[Any]:
      for attribute in key.split("""."""							):
            SCREAMING_SNAKE_CASE__   :      int      		=	getattr(__lowerCAmelCase  ,					__lowerCAmelCase							)

      if weight_type is not None:
            SCREAMING_SNAKE_CASE__   :      int      		=	getattr(__lowerCAmelCase  ,					__lowerCAmelCase							).shape
      else:
            SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	hf_pointer.shape

      assert hf_shape == value.shape, (
          F'''Shape of hf {key + '.' + weight_type if weight_type is not None else ''} is {hf_shape}, but should be'''
          F''' {value.shape} for {full_name}'''
      )

      if weight_type == "weight":
            SCREAMING_SNAKE_CASE__   :      Dict      		=	value
      elif weight_type == "weight_g":
            SCREAMING_SNAKE_CASE__   :      Dict      		=	value
      elif weight_type == "weight_v":
            SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	value
      elif weight_type == "bias":
            SCREAMING_SNAKE_CASE__   :      int      		=	value
      else:
            SCREAMING_SNAKE_CASE__   :      str      		=	value

      logger.info(F'''{key + '.' + weight_type if weight_type is not None else ''} was initialized from {full_name}.'''							)




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)       ->				Dict:
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	[]
      SCREAMING_SNAKE_CASE__   :      Dict      		=	fairseq_model.state_dict()

      SCREAMING_SNAKE_CASE__   :      str      		=	hf_model.sew.feature_extractor if is_finetuned else hf_model.feature_extractor

      for name, value in fairseq_dict.items():
            SCREAMING_SNAKE_CASE__   :      List[str]      		=	False
            if "conv_layers" in name:
                  load_conv_layer(
                      __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					hf_model.config.feat_extract_norm == """group"""  ,					)
                  SCREAMING_SNAKE_CASE__   :      List[Any]      		=	True
            else:
                  for key, mapped_key in MAPPING.items():
                        SCREAMING_SNAKE_CASE__   :      Dict      		=	"""sew.""" + mapped_key if (is_finetuned and mapped_key != """lm_head""") else mapped_key

                        if key in name or key.split("""w2v_model."""							)[-1] == name.split("""."""							)[0]:
                              SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	True
                              if "*" in mapped_key:
                                    SCREAMING_SNAKE_CASE__   :      List[Any]      		=	name.split(__lowerCAmelCase							)[0].split("""."""							)[-2]
                                    SCREAMING_SNAKE_CASE__   :      List[str]      		=	mapped_key.replace("""*"""  ,					__lowerCAmelCase							)
                              if "weight_g" in name:
                                    SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	"""weight_g"""
                              elif "weight_v" in name:
                                    SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	"""weight_v"""
                              elif "weight" in name:
                                    SCREAMING_SNAKE_CASE__   :      int      		=	"""weight"""
                              elif "bias" in name:
                                    SCREAMING_SNAKE_CASE__   :      List[Any]      		=	"""bias"""
                              else:
                                    SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	None
                              set_recursively(__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)
                        continue
            if not is_used:
                  unused_weights.append(__lowerCAmelCase							)

      logger.warning(F'''Unused weights: {unused_weights}'''							)




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)       ->				Optional[int]:
      SCREAMING_SNAKE_CASE__   :      str      		=	full_name.split("""conv_layers."""							)[-1]
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	name.split("""."""							)
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	int(items[0]							)
      SCREAMING_SNAKE_CASE__   :      Any      		=	int(items[1]							)

      if type_id == 0:
            if "bias" in name:
                  assert value.shape == feature_extractor.conv_layers[layer_id].conv.bias.data.shape, (
                      F'''{full_name} has size {value.shape}, but'''
                      F''' {feature_extractor.conv_layers[layer_id].conv.bias.data.shape} was found.'''
                  )
                  SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	value
                  logger.info(F'''Feat extract conv layer {layer_id} was initialized from {full_name}.'''							)
            elif "weight" in name:
                  assert value.shape == feature_extractor.conv_layers[layer_id].conv.weight.data.shape, (
                      F'''{full_name} has size {value.shape}, but'''
                      F''' {feature_extractor.conv_layers[layer_id].conv.weight.data.shape} was found.'''
                  )
                  SCREAMING_SNAKE_CASE__   :      int      		=	value
                  logger.info(F'''Feat extract conv layer {layer_id} was initialized from {full_name}.'''							)
      elif (type_id == 2 and not use_group_norm) or (type_id == 2 and layer_id == 0 and use_group_norm):
            if "bias" in name:
                  assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.bias.data.shape, (
                      F'''{full_name} has size {value.shape}, but {feature_extractor[layer_id].layer_norm.bias.data.shape} was'''
                      " found."
                  )
                  SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	value
                  logger.info(F'''Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.'''							)
            elif "weight" in name:
                  assert value.shape == feature_extractor.conv_layers[layer_id].layer_norm.weight.data.shape, (
                      F'''{full_name} has size {value.shape}, but'''
                      F''' {feature_extractor[layer_id].layer_norm.weight.data.shape} was found.'''
                  )
                  SCREAMING_SNAKE_CASE__   :      Any      		=	value
                  logger.info(F'''Feat extract layer norm weight of layer {layer_id} was initialized from {full_name}.'''							)
      else:
            unused_weights.append(__lowerCAmelCase							)




def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase							)       ->				List[str]:
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	SEWConfig()
      if is_finetuned:
            SCREAMING_SNAKE_CASE__   :      Tuple      		=	model.wav_encoder.wav_model.cfg
      else:
            SCREAMING_SNAKE_CASE__   :      Dict      		=	model.cfg

      SCREAMING_SNAKE_CASE__   :      Any      		=	fs_config.conv_bias
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	eval(fs_config.conv_feature_layers							)
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	[x[0] for x in conv_layers]
      SCREAMING_SNAKE_CASE__   :      List[Any]      		=	[x[1] for x in conv_layers]
      SCREAMING_SNAKE_CASE__   :      Dict      		=	[x[2] for x in conv_layers]
      SCREAMING_SNAKE_CASE__   :      List[str]      		=	"""gelu"""
      SCREAMING_SNAKE_CASE__   :      str      		=	"""layer""" if fs_config.extractor_mode == """layer_norm""" else """group"""
      SCREAMING_SNAKE_CASE__   :      Any      		=	0.0
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	fs_config.activation_fn.name
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	fs_config.encoder_embed_dim
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	0.02
      SCREAMING_SNAKE_CASE__   :      str      		=	fs_config.encoder_ffn_embed_dim
      SCREAMING_SNAKE_CASE__   :      str      		=	1E-5
      SCREAMING_SNAKE_CASE__   :      str      		=	fs_config.encoder_layerdrop
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	fs_config.encoder_attention_heads
      SCREAMING_SNAKE_CASE__   :      int      		=	fs_config.conv_pos_groups
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	fs_config.conv_pos
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	len(__lowerCAmelCase							)
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	fs_config.encoder_layers
      SCREAMING_SNAKE_CASE__   :      Any      		=	fs_config.squeeze_factor

      # take care of any params that are overridden by the Wav2VecCtc model
      if is_finetuned:
            SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	model.cfg
            SCREAMING_SNAKE_CASE__   :      str      		=	fs_config.final_dropout
            SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	fs_config.layerdrop
      SCREAMING_SNAKE_CASE__   :      List[str]      		=	fs_config.activation_dropout
      SCREAMING_SNAKE_CASE__   :      Any      		=	fs_config.mask_prob > 0 or fs_config.mask_channel_prob > 0
      SCREAMING_SNAKE_CASE__   :      str      		=	fs_config.attention_dropout
      SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	fs_config.dropout_input
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	fs_config.dropout
      SCREAMING_SNAKE_CASE__   :      Dict      		=	fs_config.mask_channel_length
      SCREAMING_SNAKE_CASE__   :      int      		=	fs_config.mask_channel_prob
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	fs_config.mask_length
      SCREAMING_SNAKE_CASE__   :      Tuple      		=	fs_config.mask_prob

      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	"""Wav2Vec2FeatureExtractor"""
      SCREAMING_SNAKE_CASE__   :      int      		=	"""Wav2Vec2CTCTokenizer"""

      return config




@torch.no_grad()
def  _lowercase					(    __lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase=None  ,					__lowerCAmelCase=None  ,					__lowerCAmelCase=True							)       ->				str:

      if is_finetuned:
            SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__   :      List[str]      		=	fairseq.checkpoint_utils.load_model_ensemble_and_task(
                [checkpoint_path]  ,					arg_overrides={"""data""": """/""".join(dict_path.split("""/"""							)[:-1]							)}							)
      else:
            SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	fairseq.checkpoint_utils.load_model_ensemble_and_task([checkpoint_path]							)

      if config_path is not None:
            SCREAMING_SNAKE_CASE__   :      str      		=	SEWConfig.from_pretrained(__lowerCAmelCase							)
      else:
            SCREAMING_SNAKE_CASE__   :      str      		=	convert_config(model[0]  ,					__lowerCAmelCase							)
      SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	model[0].eval()

      SCREAMING_SNAKE_CASE__   :      Dict      		=	True if config.feat_extract_norm == """layer""" else False
      SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	WavaVecaFeatureExtractor(
          feature_size=1  ,					sampling_rate=1_6000  ,					padding_value=0  ,					do_normalize=__lowerCAmelCase  ,					return_attention_mask=__lowerCAmelCase  ,					)

      if is_finetuned:
            if dict_path:
                  SCREAMING_SNAKE_CASE__   :      str      		=	Dictionary.load(__lowerCAmelCase							)

                  # important change bos & pad token id since CTC symbol is <pad> and
                  # not <s> as in fairseq
                  SCREAMING_SNAKE_CASE__   :      Tuple      		=	target_dict.pad_index
                  SCREAMING_SNAKE_CASE__   :      List[str]      		=	target_dict.bos_index
                  SCREAMING_SNAKE_CASE__   :      Any      		=	target_dict.pad_index
                  SCREAMING_SNAKE_CASE__   :      Any      		=	target_dict.bos_index
                  SCREAMING_SNAKE_CASE__   :      int      		=	target_dict.eos_index
                  SCREAMING_SNAKE_CASE__   :      List[str]      		=	len(target_dict.symbols							)
                  SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	os.path.join(__lowerCAmelCase  ,					"""vocab.json"""							)
                  if not os.path.isdir(__lowerCAmelCase							):
                        logger.error("""--pytorch_dump_folder_path ({}) should be a directory""".format(__lowerCAmelCase							)							)
                        return
                  os.makedirs(__lowerCAmelCase  ,					exist_ok=__lowerCAmelCase							)
                  with open(__lowerCAmelCase  ,					"""w"""  ,					encoding="""utf-8"""							) as vocab_handle:
                        json.dump(target_dict.indices  ,					__lowerCAmelCase							)
                  SCREAMING_SNAKE_CASE__   :      Dict      		=	WavaVecaCTCTokenizer(
                      __lowerCAmelCase  ,					unk_token=target_dict.unk_word  ,					pad_token=target_dict.pad_word  ,					bos_token=target_dict.bos_word  ,					eos_token=target_dict.eos_word  ,					word_delimiter_token="""|"""  ,					do_lower_case=__lowerCAmelCase  ,					)
                  SCREAMING_SNAKE_CASE__   :      int      		=	WavaVecaProcessor(feature_extractor=__lowerCAmelCase  ,					tokenizer=__lowerCAmelCase							)
                  processor.save_pretrained(__lowerCAmelCase							)

            SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	SEWForCTC(__lowerCAmelCase							)
      else:
            SCREAMING_SNAKE_CASE__   :      Dict      		=	SEWModel(__lowerCAmelCase							)
            feature_extractor.save_pretrained(__lowerCAmelCase							)

      recursively_load_weights(__lowerCAmelCase  ,					__lowerCAmelCase  ,					__lowerCAmelCase							)

      hf_model.save_pretrained(__lowerCAmelCase							)


if __name__ == "__main__":
  a					:List[Any]    = argparse.ArgumentParser()
  parser.add_argument("--pytorch_dump_folder_path", default=None, type=str, help="Path to the output PyTorch model.")
  parser.add_argument("--checkpoint_path", default=None, type=str, help="Path to fairseq checkpoint")
  parser.add_argument("--dict_path", default=None, type=str, help="Path to dict of fine-tuned model")
  parser.add_argument("--config_path", default=None, type=str, help="Path to hf config.json of model to convert")
  parser.add_argument(
      "--is_finetuned", action="store_true", help="Whether the model to convert is a fine-tuned model or not"
  )
  a					:Dict    = parser.parse_args()
  convert_sew_checkpoint(
      args.checkpoint_path, args.pytorch_dump_folder_path, args.config_path, args.dict_path, args.is_finetuned
  )







"""simple docstring"""


import unittest

import numpy as np

from transformers import RoFormerConfig, is_flax_available
from transformers.testing_utils import require_flax, slow

from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
  import jax.numpy as jnp

  from transformers.models.roformer.modeling_flax_roformer import (
      FlaxRoFormerForMaskedLM,
      FlaxRoFormerForMultipleChoice,
      FlaxRoFormerForQuestionAnswering,
      FlaxRoFormerForSequenceClassification,
      FlaxRoFormerForTokenClassification,
      FlaxRoFormerModel,
  )

class      __a							(unittest.TestCase):






     '''simple docstring'''

     def __init__(						self	,    _a	,    _a=13	,    _a=7	,    _a=True	,    _a=True	,    _a=True	,    _a=True	,    _a=99	,    _a=32	,    _a=5	,    _a=4	,    _a=37	,    _a="gelu"	,    _a=0.1	,    _a=0.1	,    _a=512	,    _a=16	,    _a=2	,    _a=0.02	,    _a=4	,    )  ->      List[str]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      str      		=	parent
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	batch_size
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	seq_length
           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	is_training
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	use_attention_mask
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	use_token_type_ids
           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	use_labels
           SCREAMING_SNAKE_CASE__   :      int      		=	vocab_size
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	hidden_size
           SCREAMING_SNAKE_CASE__   :      List[Any]      		=	num_hidden_layers
           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	num_attention_heads
           SCREAMING_SNAKE_CASE__   :      Dict      		=	intermediate_size
           SCREAMING_SNAKE_CASE__   :      int      		=	hidden_act
           SCREAMING_SNAKE_CASE__   :      Dict      		=	hidden_dropout_prob
           SCREAMING_SNAKE_CASE__   :      str      		=	attention_probs_dropout_prob
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	max_position_embeddings
           SCREAMING_SNAKE_CASE__   :      Dict      		=	type_vocab_size
           SCREAMING_SNAKE_CASE__   :      Any      		=	type_sequence_label_size
           SCREAMING_SNAKE_CASE__   :      int      		=	initializer_range
           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	num_choices

     def 					_a			(						self  )  ->      Optional[int]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Tuple      		=	ids_tensor([self.batch_size, self.seq_length]	,    self.vocab_size  )

           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	None
           if self.use_attention_mask:
                 SCREAMING_SNAKE_CASE__   :      int      		=	random_attention_mask([self.batch_size, self.seq_length]  )

           SCREAMING_SNAKE_CASE__   :      Tuple      		=	None
           if self.use_token_type_ids:
                 SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	ids_tensor([self.batch_size, self.seq_length]	,    self.type_vocab_size  )

           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	RoFormerConfig(
               vocab_size=self.vocab_size	,    hidden_size=self.hidden_size	,    num_hidden_layers=self.num_hidden_layers	,    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	,    is_decoder=_a	,    initializer_range=self.initializer_range	,    )

           return config, input_ids, token_type_ids, attention_mask





     def 					_a			(						self  )  ->      Tuple:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Optional[int]      		=	self.prepare_config_and_inputs()
           SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__		,		SCREAMING_SNAKE_CASE__   :      List[str]      		=	config_and_inputs
           SCREAMING_SNAKE_CASE__   :      List[Any]      		=	{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": attention_mask}
           return config, inputs_dict





@require_flax
class      __a							(UpperCamelCase_   ,	unittest.TestCase):






     '''simple docstring'''
     _SCREAMING_SNAKE_CASE						:Any       = True

     _SCREAMING_SNAKE_CASE						:Optional[Any]       = (
         (
             FlaxRoFormerModel,
             FlaxRoFormerForMaskedLM,
             FlaxRoFormerForSequenceClassification,
             FlaxRoFormerForTokenClassification,
             FlaxRoFormerForMultipleChoice,
             FlaxRoFormerForQuestionAnswering,
         )
         if is_flax_available()
         else ()
     )

     def 					_a			(						self  )  ->      List[Any]:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	FlaxRoFormerModelTester(self  )





     @slow
     def 					_a			(						self  )  ->      int:


           """simple docstring"""


           for model_class_name in self.all_model_classes:
                 SCREAMING_SNAKE_CASE__   :      Tuple      		=	model_class_name.from_pretrained("""junnyu/roformer_chinese_small"""	,    from_pt=_a  )
                 SCREAMING_SNAKE_CASE__   :      Tuple      		=	model(np.ones((1, 1)  )  )
                 self.assertIsNotNone(_a  )





@require_flax
class      __a							(unittest.TestCase):






     '''simple docstring'''

     @slow
     def 					_a			(						self  )  ->      Dict:


           """simple docstring"""


           SCREAMING_SNAKE_CASE__   :      Union[str, Any]      		=	FlaxRoFormerForMaskedLM.from_pretrained("""junnyu/roformer_chinese_base"""  )
           SCREAMING_SNAKE_CASE__   :      Tuple      		=	jnp.array([[0, 1, 2, 3, 4, 5]]  )
           SCREAMING_SNAKE_CASE__   :      str      		=	model(_a  )[0]

           SCREAMING_SNAKE_CASE__   :      List[Any]      		=	50_000

           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	(1, 6, vocab_size)
           self.assertEqual(output.shape	,    _a  )

           SCREAMING_SNAKE_CASE__   :      Optional[Any]      		=	jnp.array(
               [[[-0.1_205, -1.0_265, 0.2_922], [-1.5_134, 0.1_974, 0.1_519], [-5.0_135, -3.9_003, -0.8_404]]]  )

           self.assertTrue(jnp.allclose(output[:, :3, :3]	,    _a	,    atol=1E-4  )  )




