





import argparse
import json
from pathlib import Path

import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image

from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel
from transformers.utils import logging


logging.set_verbosity_info()
__A							:			str         =			logging.get_logger(__name__)





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE=False				)							-> int:




    """simple docstring"""




    _A     =							[]
    for i in range(config.num_hidden_layers				):
        # encoder layers: output projection, 2 feedforward neural networks and 2 layernorms
        rename_keys.append((F"blocks.{i}.norm1.weight", F"vit.encoder.layer.{i}.layernorm_before.weight")				)
        rename_keys.append((F"blocks.{i}.norm1.bias", F"vit.encoder.layer.{i}.layernorm_before.bias")				)
        rename_keys.append((F"blocks.{i}.attn.proj.weight", F"vit.encoder.layer.{i}.attention.output.dense.weight")				)
        rename_keys.append((F"blocks.{i}.attn.proj.bias", F"vit.encoder.layer.{i}.attention.output.dense.bias")				)
        rename_keys.append((F"blocks.{i}.norm2.weight", F"vit.encoder.layer.{i}.layernorm_after.weight")				)
        rename_keys.append((F"blocks.{i}.norm2.bias", F"vit.encoder.layer.{i}.layernorm_after.bias")				)
        rename_keys.append((F"blocks.{i}.mlp.fc1.weight", F"vit.encoder.layer.{i}.intermediate.dense.weight")				)
        rename_keys.append((F"blocks.{i}.mlp.fc1.bias", F"vit.encoder.layer.{i}.intermediate.dense.bias")				)
        rename_keys.append((F"blocks.{i}.mlp.fc2.weight", F"vit.encoder.layer.{i}.output.dense.weight")				)
        rename_keys.append((F"blocks.{i}.mlp.fc2.bias", F"vit.encoder.layer.{i}.output.dense.bias")				)

    # projection layer + position embeddings
    rename_keys.extend(
        [
            ('cls_token', 'vit.embeddings.cls_token'),
            ('patch_embed.proj.weight', 'vit.embeddings.patch_embeddings.projection.weight'),
            ('patch_embed.proj.bias', 'vit.embeddings.patch_embeddings.projection.bias'),
            ('pos_embed', 'vit.embeddings.position_embeddings'),
        ]				)

    if base_model:
        # layernorm + pooler
        rename_keys.extend(
            [
                ('norm.weight', 'layernorm.weight'),
                ('norm.bias', 'layernorm.bias'),
            ]				)

        # if just the base model, we should remove "vit" from all keys that start with "vit"
        _A     =							[(pair[0], pair[1][4:]) if pair[1].startswith('vit'				) else pair for pair in rename_keys]
    else:
        # layernorm + classification head
        rename_keys.extend(
            [
                ('norm.weight', 'vit.layernorm.weight'),
                ('norm.bias', 'vit.layernorm.bias'),
                ('head.weight', 'classifier.weight'),
                ('head.bias', 'classifier.bias'),
            ]				)

    return rename_keys





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE=False				)							-> int:




    """simple docstring"""




    for i in range(config.num_hidden_layers				):
        if base_model:
            _A     =							''
        else:
            _A     =							'vit.'
        # read in weights + bias of input projection layer (in timm, this is a single matrix + bias)
        _A     =							state_dict.pop(F"blocks.{i}.attn.qkv.weight"				)
        _A     =							state_dict.pop(F"blocks.{i}.attn.qkv.bias"				)
        # next, add query, keys and values (in that order) to the state dict
        _A     =							in_proj_weight[
            : config.hidden_size, :
        ]
        _A     =							in_proj_bias[: config.hidden_size]
        _A     =							in_proj_weight[
            config.hidden_size : config.hidden_size * 2, :
        ]
        _A     =							in_proj_bias[
            config.hidden_size : config.hidden_size * 2
        ]
        _A     =							in_proj_weight[
            -config.hidden_size :, :
        ]
        _A     =							in_proj_bias[-config.hidden_size :]





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE				)							-> List[str]:




    """simple docstring"""




    _A     =							['head.weight', 'head.bias']
    for k in ignore_keys:
        state_dict.pop(_SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)							-> List[str]:




    """simple docstring"""




    _A     =							dct.pop(_SCREAMING_SNAKE_CASE				)
    _A     =							val





def 				__lowerCAmelCase(       )							-> str:




    """simple docstring"""




    _A     =							'http://images.cocodataset.org/val2017/000000039769.jpg'
    _A     =							Image.open(requests.get(_SCREAMING_SNAKE_CASE							,     stream=_SCREAMING_SNAKE_CASE				).raw				)
    return im





@torch.no_grad()
def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE=True				)							-> Optional[Any]:




    """simple docstring"""




    _A     =							ViTConfig()
    # patch_size
    if model_name[-1] == "8":
        _A     =							8
    # set labels if required
    if not base_model:
        _A     =							1_000
        _A     =							'huggingface/label-files'
        _A     =							'imagenet-1k-id2label.json'
        _A     =							json.load(open(hf_hub_download(_SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     repo_type='dataset'				)							,     'r'				)				)
        _A     =							{int(_SCREAMING_SNAKE_CASE				): v for k, v in idalabel.items()}
        _A     =							idalabel
        _A     =							{v: k for k, v in idalabel.items()}
    # size of the architecture
    if model_name in ["dino_vits8", "dino_vits16"]:
        _A     =							384
        _A     =							1_536
        _A     =							12
        _A     =							6

    # load original model from torch hub
    _A     =							torch.hub.load('facebookresearch/dino:main'							,     _SCREAMING_SNAKE_CASE				)
    original_model.eval()

    # load state_dict of original model, remove and rename some keys
    _A     =							original_model.state_dict()
    if base_model:
        remove_classification_head_(_SCREAMING_SNAKE_CASE				)
    _A     =							create_rename_keys(_SCREAMING_SNAKE_CASE							,     base_model=_SCREAMING_SNAKE_CASE				)
    for src, dest in rename_keys:
        rename_key(_SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)
    read_in_q_k_v(_SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)

    # load HuggingFace model
    if base_model:
        _A     =							ViTModel(_SCREAMING_SNAKE_CASE							,     add_pooling_layer=_SCREAMING_SNAKE_CASE				).eval()
    else:
        _A     =							ViTForImageClassification(_SCREAMING_SNAKE_CASE				).eval()
    model.load_state_dict(_SCREAMING_SNAKE_CASE				)

    # Check outputs on an image, prepared by ViTImageProcessor
    _A     =							ViTImageProcessor()
    _A     =							image_processor(images=prepare_img()							,     return_tensors='pt'				)
    _A     =							encoding['pixel_values']
    _A     =							model(_SCREAMING_SNAKE_CASE				)

    if base_model:
        _A     =							original_model(_SCREAMING_SNAKE_CASE				)
        assert torch.allclose(_SCREAMING_SNAKE_CASE							,     outputs.last_hidden_state[:, 0, :]							,     atol=1e-1				)
    else:
        _A     =							original_model(_SCREAMING_SNAKE_CASE				)
        assert logits.shape == outputs.logits.shape
        assert torch.allclose(_SCREAMING_SNAKE_CASE							,     outputs.logits							,     atol=1e-3				)

    Path(_SCREAMING_SNAKE_CASE				).mkdir(exist_ok=_SCREAMING_SNAKE_CASE				)
    print(F"Saving model {model_name} to {pytorch_dump_folder_path}"				)
    model.save_pretrained(_SCREAMING_SNAKE_CASE				)
    print(F"Saving image processor to {pytorch_dump_folder_path}"				)
    image_processor.save_pretrained(_SCREAMING_SNAKE_CASE				)


if __name__ == "__main__":
 __A							:			List[Any]         =			argparse.ArgumentParser()
 # Required parameters
 parser.add_argument(
     "--model_name",
     default="dino_vitb16",
     type=str,
     help="Name of the model trained with DINO you'd like to convert.",
 )
 parser.add_argument(
     "--pytorch_dump_folder_path", default=None, type=str, help="Path to the output PyTorch model directory."
 )
 parser.add_argument(
     "--base_model",
     action="store_true",
     help="Whether to only convert the base model (no projection head weights).",
 )

 parser.set_defaults(base_model=True)
 __A							:			List[Any]         =			parser.parse_args()
 convert_vit_checkpoint(args.model_name, args.pytorch_dump_folder_path, args.base_model)













'''simple docstring'''





import inspect
import unittest

from transformers import DPTConfig
from transformers.file_utils import is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_vision, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
						import torch
						from torch import nn

						from transformers import MODEL_MAPPING, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTModel
						from transformers.models.dpt.modeling_dpt import DPT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image

						from transformers import DPTImageProcessor


class  snake_case__      :




					def __init__(  self  :		Union[str, Any]				, _A  :		Optional[Any]				, _A  :		Dict=2				, _A  :		Optional[Any]=32				, _A  :		List[str]=16				, _A  :		str=3				, _A  :		List[Any]=True				, _A  :		Optional[int]=True				, _A  :		Optional[int]=32				, _A  :		Optional[Any]=4				, _A  :		Optional[int]=[0, 1, 2, 3]				, _A  :		List[Any]=4				, _A  :		Optional[int]=37				, _A  :		Optional[Any]="gelu"				, _A  :		Optional[Any]=0.1				, _A  :		Union[str, Any]=0.1				, _A  :		Dict=0.02				, _A  :		Optional[Any]=3				, _A  :		Union[str, Any]=[1, 3_84, 24, 24]				, _A  :		int=True				, _A  :		int=None				, )    ->							Tuple:
								UpperCAmelCase_      :       Tuple          =       parent
								UpperCAmelCase_      :       List[str]          =       batch_size
								UpperCAmelCase_      :       Union[str, Any]          =       image_size
								UpperCAmelCase_      :       List[Any]          =       patch_size
								UpperCAmelCase_      :       Dict          =       num_channels
								UpperCAmelCase_      :       str          =       is_training
								UpperCAmelCase_      :       List[str]          =       use_labels
								UpperCAmelCase_      :       Optional[Any]          =       hidden_size
								UpperCAmelCase_      :       str          =       num_hidden_layers
								UpperCAmelCase_      :       int          =       backbone_out_indices
								UpperCAmelCase_      :       str          =       num_attention_heads
								UpperCAmelCase_      :       List[Any]          =       intermediate_size
								UpperCAmelCase_      :       Union[str, Any]          =       hidden_act
								UpperCAmelCase_      :       Dict          =       hidden_dropout_prob
								UpperCAmelCase_      :       Union[str, Any]          =       attention_probs_dropout_prob
								UpperCAmelCase_      :       List[str]          =       initializer_range
								UpperCAmelCase_      :       int          =       num_labels
								UpperCAmelCase_      :       Union[str, Any]          =       backbone_featmap_shape
								UpperCAmelCase_      :       List[str]          =       scope
								UpperCAmelCase_      :       List[str]          =       is_hybrid
								# sequence length of DPT = num_patches + 1 (we add 1 for the [CLS] token)
								UpperCAmelCase_      :       List[Any]          =       (image_size // patch_size) ** 2
								UpperCAmelCase_      :       List[str]          =       num_patches + 1




					def 		A      (  self  :		Dict      )    ->							Optional[int]:
								UpperCAmelCase_      :       Optional[int]          =       floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

								UpperCAmelCase_      :       List[str]          =       None
								if self.use_labels:
											UpperCAmelCase_      :       Optional[int]          =       ids_tensor([self.batch_size, self.image_size, self.image_size]				, self.num_labels      )

								UpperCAmelCase_      :       Dict          =       self.get_config()

								return config, pixel_values, labels




					def 		A      (  self  :		int      )    ->							Optional[Any]:
								UpperCAmelCase_      :       Optional[Any]          =       {
								    '''global_padding''': '''same''',
								    '''layer_type''': '''bottleneck''',
								    '''depths''': [3, 4, 9],
								    '''out_features''': ['''stage1''', '''stage2''', '''stage3'''],
								    '''embedding_dynamic_padding''': True,
								    '''hidden_sizes''': [96, 1_92, 3_84, 7_68],
								    '''num_groups''': 2,
								}

								return DPTConfig(
								    image_size=self.image_size				, patch_size=self.patch_size				, num_channels=self.num_channels				, hidden_size=self.hidden_size				, num_hidden_layers=self.num_hidden_layers				, backbone_out_indices=self.backbone_out_indices				, 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				, is_decoder=_A				, initializer_range=self.initializer_range				, is_hybrid=self.is_hybrid				, backbone_config=_A				, backbone_featmap_shape=self.backbone_featmap_shape				, )




					def 		A      (  self  :		Union[str, Any]				, _A  :		List[Any]				, _A  :		Optional[int]				, _A  :		Optional[int]      )    ->							Union[str, Any]:
								UpperCAmelCase_      :       Optional[int]          =       DPTModel(config=_A      )
								model.to(_A      )
								model.eval()
								UpperCAmelCase_      :       List[str]          =       model(_A      )
								self.parent.assertEqual(result.last_hidden_state.shape				, (self.batch_size, self.seq_length, self.hidden_size)      )




					def 		A      (  self  :		Tuple				, _A  :		str				, _A  :		Tuple				, _A  :		Union[str, Any]      )    ->							List[str]:
								UpperCAmelCase_      :       List[Any]          =       self.num_labels
								UpperCAmelCase_      :       Any          =       DPTForDepthEstimation(_A      )
								model.to(_A      )
								model.eval()
								UpperCAmelCase_      :       int          =       model(_A      )
								self.parent.assertEqual(result.predicted_depth.shape				, (self.batch_size, self.image_size, self.image_size)      )




					def 		A      (  self  :		List[str]				, _A  :		str				, _A  :		Union[str, Any]				, _A  :		int      )    ->							Dict:
								UpperCAmelCase_      :       int          =       self.num_labels
								UpperCAmelCase_      :       Optional[Any]          =       DPTForSemanticSegmentation(_A      )
								model.to(_A      )
								model.eval()
								UpperCAmelCase_      :       Tuple          =       model(_A				, labels=_A      )
								self.parent.assertEqual(
								    result.logits.shape				, (self.batch_size, self.num_labels, self.image_size, self.image_size)      )





					def 		A      (  self  :		Dict      )    ->							Any:
								UpperCAmelCase_      :       Optional[int]          =       self.prepare_config_and_inputs()
								UpperCAmelCase_    ,      UpperCAmelCase_    ,      UpperCAmelCase_      :       List[str]          =       config_and_inputs
								UpperCAmelCase_      :       Tuple          =       {'''pixel_values''': pixel_values}
								return config, inputs_dict






@require_torch
class  snake_case__      (					UpperCamelCase     ,				UpperCamelCase     ,				unittest.TestCase):
					a_        =					(DPTModel, DPTForDepthEstimation, DPTForSemanticSegmentation) if is_torch_available() else ()
					a_        =					(
					    {
					        "depth-estimation": DPTForDepthEstimation,
					        "feature-extraction": DPTModel,
					        "image-segmentation": DPTForSemanticSegmentation,
					    }
					    if is_torch_available()
					    else {}
					)

					a_        =					False
					a_        =					False
					a_        =					False




					def 		A      (  self  :		Tuple      )    ->							Tuple:
								UpperCAmelCase_      :       Any          =       DPTModelTester(self      )
								UpperCAmelCase_      :       Dict          =       ConfigTester(self				, config_class=_A				, has_text_modality=_A				, hidden_size=37      )




					def 		A      (  self  :		Optional[int]      )    ->							int:
								self.config_tester.run_common_tests()




					@unittest.skip(reason='''DPT does not use inputs_embeds'''      )
					def 		A      (  self  :		Union[str, Any]      )    ->							str:
								pass




					def 		A      (  self  :		str      )    ->							Dict:
								UpperCAmelCase_    ,      UpperCAmelCase_      :       Any          =       self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
											UpperCAmelCase_      :       Union[str, Any]          =       model_class(_A      )
											self.assertIsInstance(model.get_input_embeddings()				, (nn.Module)      )
											UpperCAmelCase_      :       Dict          =       model.get_output_embeddings()
											self.assertTrue(x is None or isinstance(_A				, nn.Linear      )      )




					def 		A      (  self  :		List[Any]      )    ->							Tuple:
								UpperCAmelCase_    ,      UpperCAmelCase_      :       List[str]          =       self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
											UpperCAmelCase_      :       Dict          =       model_class(_A      )
											UpperCAmelCase_      :       Optional[Any]          =       inspect.signature(model.forward      )
											# signature.parameters is an OrderedDict => so arg_names order is deterministic
											UpperCAmelCase_      :       int          =       [*signature.parameters.keys()]

											UpperCAmelCase_      :       Any          =       ['''pixel_values''']
											self.assertListEqual(arg_names[:1]				, _A      )




					def 		A      (  self  :		List[str]      )    ->							str:
								UpperCAmelCase_      :       List[Any]          =       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*_A      )




					def 		A      (  self  :		str      )    ->							List[str]:
								UpperCAmelCase_      :       List[Any]          =       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_depth_estimation(*_A      )




					def 		A      (  self  :		str      )    ->							List[Any]:
								UpperCAmelCase_      :       List[str]          =       self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_semantic_segmentation(*_A      )




					def 		A      (  self  :		Tuple      )    ->							str:
								for model_class in self.all_model_classes:
											if model_class.__name__ == "DPTForDepthEstimation":
														continue

											UpperCAmelCase_    ,      UpperCAmelCase_      :       int          =       self.model_tester.prepare_config_and_inputs_for_common()
											UpperCAmelCase_      :       Union[str, Any]          =       True

											if model_class in get_values(_A      ):
														continue

											UpperCAmelCase_      :       Optional[int]          =       model_class(_A      )
											model.to(_A      )
											model.train()
											UpperCAmelCase_      :       Any          =       self._prepare_for_class(_A				, _A				, return_labels=_A      )
											UpperCAmelCase_      :       Tuple          =       model(**_A      ).loss
											loss.backward()




					def 		A      (  self  :		Union[str, Any]      )    ->							Tuple:
								for model_class in self.all_model_classes:
											if model_class.__name__ == "DPTForDepthEstimation":
														continue

											UpperCAmelCase_    ,      UpperCAmelCase_      :       Tuple          =       self.model_tester.prepare_config_and_inputs_for_common()
											UpperCAmelCase_      :       List[Any]          =       False
											UpperCAmelCase_      :       Optional[Any]          =       True

											if model_class in get_values(_A      ) or not model_class.supports_gradient_checkpointing:
														continue
											UpperCAmelCase_      :       int          =       model_class(_A      )
											model.to(_A      )
											model.gradient_checkpointing_enable()
											model.train()
											UpperCAmelCase_      :       int          =       self._prepare_for_class(_A				, _A				, return_labels=_A      )
											UpperCAmelCase_      :       List[str]          =       model(**_A      ).loss
											loss.backward()




					def 		A      (  self  :		Optional[Any]      )    ->							Any:
								UpperCAmelCase_    ,      UpperCAmelCase_      :       List[str]          =       self.model_tester.prepare_config_and_inputs_for_common()

								UpperCAmelCase_      :       List[str]          =       _config_zero_init(_A      )
								for model_class in self.all_model_classes:
											UpperCAmelCase_      :       int          =       model_class(config=_A      )
											# Skip the check for the backbone
											UpperCAmelCase_      :       List[str]          =       []
											for name, module in model.named_modules():
														if module.__class__.__name__ == "DPTViTHybridEmbeddings":
																	UpperCAmelCase_      :       Union[str, Any]          =       [F"{name}.{key}" for key in module.state_dict().keys()]
																	break

											for name, param in model.named_parameters():
														if param.requires_grad:
																	if name in backbone_params:
																				continue
																	self.assertIn(
																	    ((param.data.mean() * 1e9).round() / 1e9).item()				, [0.0, 1.0]				, msg=F"Parameter {name} of model {model_class} seems not properly initialized"				, )




					@unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''      )
					def 		A      (  self  :		Tuple      )    ->							Optional[Any]:
								pass




					@slow
					def 		A      (  self  :		Any      )    ->							int:
								for model_name in DPT_PRETRAINED_MODEL_ARCHIVE_LIST[1:]:
											UpperCAmelCase_      :       Any          =       DPTModel.from_pretrained(_A      )
											self.assertIsNotNone(_A      )





					def 		A      (  self  :		Union[str, Any]      )    ->							str:
								# We do this test only for DPTForDepthEstimation since it is the only model that uses readout_type
								UpperCAmelCase_    ,      UpperCAmelCase_      :       Optional[Any]          =       self.model_tester.prepare_config_and_inputs_for_common()
								UpperCAmelCase_      :       Optional[int]          =       '''add'''
								with self.assertRaises(_A      ):
											UpperCAmelCase_      :       Optional[Any]          =       DPTForDepthEstimation(_A      )






def __UpperCAmelCase   (					)    ->   List[Any]:
			UpperCAmelCase_      :       List[Any]          =       Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''		)
			return image







@require_torch
@require_vision
@slow
class  snake_case__      (					unittest.TestCase):




					def 		A      (  self  :		Union[str, Any]      )    ->							List[Any]:
								UpperCAmelCase_      :       List[Any]          =       DPTImageProcessor.from_pretrained('''Intel/dpt-hybrid-midas'''      )
								UpperCAmelCase_      :       Any          =       DPTForDepthEstimation.from_pretrained('''Intel/dpt-hybrid-midas'''      ).to(_A      )

								UpperCAmelCase_      :       Tuple          =       prepare_img()
								UpperCAmelCase_      :       Union[str, Any]          =       image_processor(images=_A				, return_tensors='''pt'''      ).to(_A      )

								# forward pass
								with torch.no_grad():
											UpperCAmelCase_      :       str          =       model(**_A      )
											UpperCAmelCase_      :       List[Any]          =       outputs.predicted_depth

								# verify the predicted depth
								UpperCAmelCase_      :       str          =       torch.Size((1, 3_84, 3_84)      )
								self.assertEqual(predicted_depth.shape				, _A      )

								UpperCAmelCase_      :       Tuple          =       torch.tensor(
								    [[[5.6_437, 5.6_146, 5.6_511], [5.4_371, 5.5_649, 5.5_958], [5.5_215, 5.5_184, 5.5_293]]]      ).to(_A      )

								self.assertTrue(torch.allclose(outputs.predicted_depth[:3, :3, :3] / 1_00				, _A				, atol=1e-4      )      )


