





import collections
import inspect
import unittest

from transformers import SwinConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_backbone_common import BackboneTesterMixin
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 SwinBackbone, SwinForImageClassification, SwinForMaskedImageModeling, SwinModel
							from transformers.models.swin.modeling_swin import SWIN_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
							from PIL import Image

							from transformers import AutoImageProcessor

class    __A  :


				def __init__(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_=13 ,			UpperCAmelCase_=32 ,			UpperCAmelCase_=2 ,			UpperCAmelCase_=3 ,			UpperCAmelCase_=16 ,			UpperCAmelCase_=[1, 2, 1] ,			UpperCAmelCase_=[2, 2, 4] ,			UpperCAmelCase_=2 ,			UpperCAmelCase_=2.0 ,			UpperCAmelCase_=True ,			UpperCAmelCase_=0.0 ,			UpperCAmelCase_=0.0 ,			UpperCAmelCase_=0.1 ,			UpperCAmelCase_="gelu" ,			UpperCAmelCase_=False ,			UpperCAmelCase_=True ,			UpperCAmelCase_=0.0_2 ,			UpperCAmelCase_=1E-5 ,			UpperCAmelCase_=True ,			UpperCAmelCase_=None ,			UpperCAmelCase_=True ,			UpperCAmelCase_=10 ,			UpperCAmelCase_=8 ,			UpperCAmelCase_=["stage1", "stage2"] ,			UpperCAmelCase_=[1, 2] ,			):
								lowerCamelCase									=parent
								lowerCamelCase									=batch_size
								lowerCamelCase									=image_size
								lowerCamelCase									=patch_size
								lowerCamelCase									=num_channels
								lowerCamelCase									=embed_dim
								lowerCamelCase									=depths
								lowerCamelCase									=num_heads
								lowerCamelCase									=window_size
								lowerCamelCase									=mlp_ratio
								lowerCamelCase									=qkv_bias
								lowerCamelCase									=hidden_dropout_prob
								lowerCamelCase									=attention_probs_dropout_prob
								lowerCamelCase									=drop_path_rate
								lowerCamelCase									=hidden_act
								lowerCamelCase									=use_absolute_embeddings
								lowerCamelCase									=patch_norm
								lowerCamelCase									=layer_norm_eps
								lowerCamelCase									=initializer_range
								lowerCamelCase									=is_training
								lowerCamelCase									=scope
								lowerCamelCase									=use_labels
								lowerCamelCase									=type_sequence_label_size
								lowerCamelCase									=encoder_stride
								lowerCamelCase									=out_features
								lowerCamelCase									=out_indices


				def _snake_case							(		self				):
								lowerCamelCase									=floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]				)

								lowerCamelCase									=None
								if self.use_labels:
												lowerCamelCase									=ids_tensor([self.batch_size] ,			self.type_sequence_label_size				)

								lowerCamelCase									=self.get_config()

								return config, pixel_values, labels


				def _snake_case							(		self				):
								return SwinConfig(
								    image_size=self.image_size ,			patch_size=self.patch_size ,			num_channels=self.num_channels ,			embed_dim=self.embed_dim ,			depths=self.depths ,			num_heads=self.num_heads ,			window_size=self.window_size ,			mlp_ratio=self.mlp_ratio ,			qkv_bias=self.qkv_bias ,			hidden_dropout_prob=self.hidden_dropout_prob ,			attention_probs_dropout_prob=self.attention_probs_dropout_prob ,			drop_path_rate=self.drop_path_rate ,			hidden_act=self.hidden_act ,			use_absolute_embeddings=self.use_absolute_embeddings ,			path_norm=self.patch_norm ,			layer_norm_eps=self.layer_norm_eps ,			initializer_range=self.initializer_range ,			encoder_stride=self.encoder_stride ,			out_features=self.out_features ,			out_indices=self.out_indices ,			)


				def _snake_case							(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_				):
								lowerCamelCase									=SwinModel(config=A__				)
								model.to(A__				)
								model.eval()
								lowerCamelCase									=model(A__				)

								lowerCamelCase									=((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths				) - 1))
								lowerCamelCase									=int(config.embed_dim * 2 ** (len(config.depths				) - 1)				)

								self.parent.assertEqual(result.last_hidden_state.shape ,			(self.batch_size, expected_seq_len, expected_dim)				)


				def _snake_case							(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_				):
								lowerCamelCase									=SwinBackbone(config=A__				)
								model.to(A__				)
								model.eval()
								lowerCamelCase									=model(A__				)

								# verify hidden states
								self.parent.assertEqual(len(result.feature_maps				) ,			len(config.out_features				)				)
								self.parent.assertListEqual(list(result.feature_maps[0].shape				) ,			[self.batch_size, model.channels[0], 16, 16]				)

								# verify channels
								self.parent.assertEqual(len(model.channels				) ,			len(config.out_features				)				)

								# verify backbone works with out_features=None
								lowerCamelCase									=None
								lowerCamelCase									=SwinBackbone(config=A__				)
								model.to(A__				)
								model.eval()
								lowerCamelCase									=model(A__				)

								# verify feature maps
								self.parent.assertEqual(len(result.feature_maps				) ,			1				)
								self.parent.assertListEqual(list(result.feature_maps[0].shape				) ,			[self.batch_size, model.channels[-1], 4, 4]				)

								# verify channels
								self.parent.assertEqual(len(model.channels				) ,			1				)


				def _snake_case							(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_				):
								lowerCamelCase									=SwinForMaskedImageModeling(config=A__				)
								model.to(A__				)
								model.eval()
								lowerCamelCase									=model(A__				)
								self.parent.assertEqual(
								    result.logits.shape ,			(self.batch_size, self.num_channels, self.image_size, self.image_size)				)

								# test greyscale images
								lowerCamelCase									=1
								lowerCamelCase									=SwinForMaskedImageModeling(A__				)
								model.to(A__				)
								model.eval()

								lowerCamelCase									=floats_tensor([self.batch_size, 1, self.image_size, self.image_size]				)
								lowerCamelCase									=model(A__				)
								self.parent.assertEqual(result.logits.shape ,			(self.batch_size, 1, self.image_size, self.image_size)				)


				def _snake_case							(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_				):
								lowerCamelCase									=self.type_sequence_label_size
								lowerCamelCase									=SwinForImageClassification(A__				)
								model.to(A__				)
								model.eval()
								lowerCamelCase									=model(A__ ,			labels=A__				)
								self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.type_sequence_label_size)				)

								# test greyscale images
								lowerCamelCase									=1
								lowerCamelCase									=SwinForImageClassification(A__				)
								model.to(A__				)
								model.eval()

								lowerCamelCase									=floats_tensor([self.batch_size, 1, self.image_size, self.image_size]				)
								lowerCamelCase									=model(A__				)
								self.parent.assertEqual(result.logits.shape ,			(self.batch_size, self.type_sequence_label_size)				)


				def _snake_case							(		self				):
								lowerCamelCase									=self.prepare_config_and_inputs()
								(
								    (
								    lowerCamelCase		
								)			,	(
								    lowerCamelCase		
								)			,	(
								    lowerCamelCase		
								)			,			
								)									=config_and_inputs
								lowerCamelCase									={"""pixel_values""": pixel_values}
								return config, inputs_dict




@require_torch
class    __A  (    SCREAMING_SNAKE_CASE__     ,       SCREAMING_SNAKE_CASE__     ,       unittest.TestCase     ):
				__A  =					(
				    (
				        SwinModel,
				        SwinBackbone,
				        SwinForImageClassification,
				        SwinForMaskedImageModeling,
				    )
				    if is_torch_available()
				    else ()
				)
				__A  =					(
				    {'''feature-extraction''': SwinModel, '''image-classification''': SwinForImageClassification}
				    if is_torch_available()
				    else {}
				)
				__A  =					True

				__A  =					False
				__A  =					False
				__A  =					False


				def _snake_case							(		self				):
								lowerCamelCase									=SwinModelTester(self				)
								lowerCamelCase									=ConfigTester(self ,			config_class=A__ ,			embed_dim=37				)


				def _snake_case							(		self				):
								self.create_and_test_config_common_properties()
								self.config_tester.create_and_test_config_to_json_string()
								self.config_tester.create_and_test_config_to_json_file()
								self.config_tester.create_and_test_config_from_and_save_pretrained()
								self.config_tester.create_and_test_config_with_num_labels()
								self.config_tester.check_config_can_be_init_without_params()
								self.config_tester.check_config_arguments_init()


				def _snake_case							(		self				):
								return


				def _snake_case							(		self				):
								lowerCamelCase									=self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_model(*A__				)


				@unittest.skip(reason="""Got `CUDA error: misaligned address` with PyTorch 2.0.0."""				)
				def _snake_case							(		self				):
								pass


				def _snake_case							(		self				):
								super().test_training_gradient_checkpointing()


				def _snake_case							(		self				):
								lowerCamelCase									=self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_backbone(*A__				)


				def _snake_case							(		self				):
								lowerCamelCase									=self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_masked_image_modeling(*A__				)


				def _snake_case							(		self				):
								lowerCamelCase									=self.model_tester.prepare_config_and_inputs()
								self.model_tester.create_and_check_for_image_classification(*A__				)


				@unittest.skip(reason="""Swin does not use inputs_embeds"""				)
				def _snake_case							(		self				):
								pass


				@unittest.skip(reason="""Swin Transformer does not use feedforward chunking"""				)
				def _snake_case							(		self				):
								pass


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
												lowerCamelCase									=model_class(A__				)
												self.assertIsInstance(model.get_input_embeddings() ,			(nn.Module)				)
												lowerCamelCase									=model.get_output_embeddings()
												self.assertTrue(x is None or isinstance(A__ ,			nn.Linear				)				)


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()

								for model_class in self.all_model_classes:
												lowerCamelCase									=model_class(A__				)
												lowerCamelCase									=inspect.signature(model.forward				)
												# signature.parameters is an OrderedDict => so arg_names order is deterministic
												lowerCamelCase									=[*signature.parameters.keys()]

												lowerCamelCase									=["""pixel_values"""]
												self.assertListEqual(arg_names[:1] ,			A__				)


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()
								lowerCamelCase									=True

								for model_class in self.all_model_classes:
												lowerCamelCase									=True
												lowerCamelCase									=False
												lowerCamelCase									=True
												lowerCamelCase									=model_class(A__				)
												model.to(A__				)
												model.eval()
												with torch.no_grad():
																lowerCamelCase									=model(**self._prepare_for_class(A__ ,			A__				)				)
												lowerCamelCase									=outputs.attentions
												lowerCamelCase									=len(self.model_tester.depths				)
												self.assertEqual(len(A__				) ,			A__				)

												# check that output_attentions also work using config
												del inputs_dict["output_attentions"]
												lowerCamelCase									=True
												lowerCamelCase									=config.window_size**2
												lowerCamelCase									=model_class(A__				)
												model.to(A__				)
												model.eval()
												with torch.no_grad():
																lowerCamelCase									=model(**self._prepare_for_class(A__ ,			A__				)				)
												lowerCamelCase									=outputs.attentions
												self.assertEqual(len(A__				) ,			A__				)

												self.assertListEqual(
												    list(attentions[0].shape[-3:]				) ,			[self.model_tester.num_heads[0], window_size_squared, window_size_squared] ,			)
												lowerCamelCase									=len(A__				)

												# Check attention is always last and order is fine
												lowerCamelCase									=True
												lowerCamelCase									=True
												lowerCamelCase									=model_class(A__				)
												model.to(A__				)
												model.eval()
												with torch.no_grad():
																lowerCamelCase									=model(**self._prepare_for_class(A__ ,			A__				)				)

												# also another +1 for reshaped_hidden_states
												lowerCamelCase									=1 if model_class.__name__ == """SwinBackbone""" else 2
												self.assertEqual(out_len + added_hidden_states ,			len(A__				)				)

												lowerCamelCase									=outputs.attentions

												self.assertEqual(len(A__				) ,			A__				)

												self.assertListEqual(
												    list(self_attentions[0].shape[-3:]				) ,			[self.model_tester.num_heads[0], window_size_squared, window_size_squared] ,			)


				def _snake_case							(		self ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_ ,			UpperCAmelCase_				):
								lowerCamelCase									=model_class(A__				)
								model.to(A__				)
								model.eval()

								with torch.no_grad():
												lowerCamelCase									=model(**self._prepare_for_class(A__ ,			A__				)				)

								lowerCamelCase									=outputs.hidden_states

								lowerCamelCase									=getattr(
								    self.model_tester ,			"""expected_num_hidden_layers""" ,			len(self.model_tester.depths				) + 1				)
								self.assertEqual(len(A__				) ,			A__				)

								# Swin has a different seq_length
								lowerCamelCase									=(
								    config.patch_size
								    if isinstance(config.patch_size ,			collections.abc.Iterable				)
								    else (config.patch_size, config.patch_size)
								)

								lowerCamelCase									=(image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

								self.assertListEqual(
								    list(hidden_states[0].shape[-2:]				) ,			[num_patches, self.model_tester.embed_dim] ,			)

								if not model_class.__name__ == "SwinBackbone":
												lowerCamelCase									=outputs.reshaped_hidden_states
												self.assertEqual(len(A__				) ,			A__				)

												lowerCamelCase			,	lowerCamelCase			,	lowerCamelCase			,	lowerCamelCase									=reshaped_hidden_states[0].shape
												lowerCamelCase									=(
												    reshaped_hidden_states[0].view(A__ ,			A__ ,			height * width				).permute(0 ,			2 ,			1				)
												)
												self.assertListEqual(
												    list(reshaped_hidden_states.shape[-2:]				) ,			[num_patches, self.model_tester.embed_dim] ,			)


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()

								lowerCamelCase									=(
								    self.model_tester.image_size
								    if isinstance(self.model_tester.image_size ,			collections.abc.Iterable				)
								    else (self.model_tester.image_size, self.model_tester.image_size)
								)

								for model_class in self.all_model_classes:
												lowerCamelCase									=True
												self.check_hidden_states_output(A__ ,			A__ ,			A__ ,			A__				)

												# check that output_hidden_states also work using config
												del inputs_dict["output_hidden_states"]
												lowerCamelCase									=True

												self.check_hidden_states_output(A__ ,			A__ ,			A__ ,			A__				)


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()
								lowerCamelCase									=3

								lowerCamelCase									=(
								    self.model_tester.image_size
								    if isinstance(self.model_tester.image_size ,			collections.abc.Iterable				)
								    else (self.model_tester.image_size, self.model_tester.image_size)
								)
								lowerCamelCase									=(
								    config.patch_size
								    if isinstance(config.patch_size ,			collections.abc.Iterable				)
								    else (config.patch_size, config.patch_size)
								)

								lowerCamelCase									=image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
								lowerCamelCase									=image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

								for model_class in self.all_model_classes:
												lowerCamelCase									=True
												self.check_hidden_states_output(A__ ,			A__ ,			A__ ,			(padded_height, padded_width)				)

												# check that output_hidden_states also work using config
												del inputs_dict["output_hidden_states"]
												lowerCamelCase									=True
												self.check_hidden_states_output(A__ ,			A__ ,			A__ ,			(padded_height, padded_width)				)


				@slow
				def _snake_case							(		self				):
								for model_name in SWIN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
												lowerCamelCase									=SwinModel.from_pretrained(A__				)
												self.assertIsNotNone(A__				)


				def _snake_case							(		self				):
								lowerCamelCase			,	lowerCamelCase									=self.model_tester.prepare_config_and_inputs_for_common()

								lowerCamelCase									=_config_zero_init(A__				)
								for model_class in self.all_model_classes:
												lowerCamelCase									=model_class(config=A__				)
												for name, param in model.named_parameters():
																if "embeddings" not in name and param.requires_grad:
																				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""" ,			)




@require_vision
@require_torch
class    __A  (    unittest.TestCase     ):


				@cached_property
				def _snake_case							(		self				):
								return (
								    AutoImageProcessor.from_pretrained("""microsoft/swin-tiny-patch4-window7-224"""				)
								    if is_vision_available()
								    else None
								)


				@slow
				def _snake_case							(		self				):
								lowerCamelCase									=SwinForImageClassification.from_pretrained("""microsoft/swin-tiny-patch4-window7-224"""				).to(A__				)
								lowerCamelCase									=self.default_image_processor

								lowerCamelCase									=Image.open("""./tests/fixtures/tests_samples/COCO/000000039769.png"""				)
								lowerCamelCase									=image_processor(images=A__ ,			return_tensors="""pt"""				).to(A__				)

								# forward pass
								with torch.no_grad():
												lowerCamelCase									=model(**A__				)

								# verify the logits
								lowerCamelCase									=torch.Size((1, 1000)				)
								self.assertEqual(outputs.logits.shape ,			A__				)
								lowerCamelCase									=torch.tensor([-0.0_9_4_8, -0.6_4_5_4, -0.0_9_2_1]				).to(A__				)
								self.assertTrue(torch.allclose(outputs.logits[0, :3] ,			A__ ,			atol=1E-4				)				)




@require_torch
class    __A  (    unittest.TestCase     ,       SCREAMING_SNAKE_CASE__     ):
				__A  =					(SwinBackbone,) if is_torch_available() else ()
				__A  =					SwinConfig


				def _snake_case							(		self				):
								lowerCamelCase									=SwinModelTester(self				)







# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from typing import List



def 			UpperCamelCase       (				lowerCAmelCase__					,     lowerCAmelCase__						):
					'''simple docstring'''
					if name != "training_function" and name != "main":
										raise ValueError(f'Incorrect function name passed: {name}, choose either \'main\' or \'training_function\''						)
					lowercase      ,		lowercase		      =		[], False
					for line in lines:
										if not found_start and f'def {name}' in line:
															lowercase		      =		True
															good_lines.append(lowerCAmelCase__						)
															continue
										if found_start:
															if name == "training_function" and "def main" in line:
																				return good_lines
															if name == "main" and "if __name__" in line:
																				return good_lines
															good_lines.append(lowerCAmelCase__						)



def 			UpperCamelCase       (				lowerCAmelCase__						):
					'''simple docstring'''
					return [line for line in lines if not line.lstrip().startswith('''#'''						) and line != "\n"]



def 			UpperCamelCase       (				lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__					,     lowerCAmelCase__ = None						):
					'''simple docstring'''
					with open(lowerCAmelCase__					,     '''r'''						) as f:
										lowercase		      =		f.readlines()
					with open(os.path.abspath(os.path.join('''examples'''					,     '''nlp_example.py'''						)						)					,     '''r'''						) as f:
										lowercase		      =		f.readlines()
					with open(lowerCAmelCase__					,     '''r'''						) as f:
										lowercase		      =		f.readlines()
					if secondary_filename is not None:
										with open(lowerCAmelCase__					,     '''r'''						) as f:
															lowercase		      =		f.readlines()

    # This is our base, we remove all the code from here in our `full_filename` and `feature_filename` to find the new content
					if parser_only:
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''main'''						)						)
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''main'''						)						)
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''main'''						)						)
										if secondary_filename is not None:
															lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''main'''						)						)
					else:
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''training_function'''						)						)
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''training_function'''						)						)
										lowercase		      =		clean_lines(get_function_contents_by_name(lowerCAmelCase__					,     '''training_function'''						)						)
										if secondary_filename is not None:
															lowercase		      =		clean_lines(
															    get_function_contents_by_name(lowerCAmelCase__					,     '''training_function'''						)						)

					lowercase		      =		'''train_dataloader, eval_dataloader = get_dataloaders(accelerator, batch_size)\n'''

					# Specific code in our script that differs from the full version, aka what is new
					lowercase		      =		[]
					lowercase		      =		[]  # We keep track of the idxs just in case it's a repeated statement
					lowercase		      =		iter(lowerCAmelCase__						)
					for i in range(len(lowerCAmelCase__						) - 1						):
										if i not in passed_idxs:
															lowercase		      =		next(lowerCAmelCase__						)
															if (line not in full_file_func) and (line.lstrip() != _dl_line):
																				if "TESTING_MOCKED_DATALOADERS" not in line:
																									new_feature_code.append(lowerCAmelCase__						)
																									passed_idxs.append(lowerCAmelCase__						)
																				else:
																									# Skip over the `config['num_epochs'] = 2` statement
																									lowercase		      =		next(lowerCAmelCase__						)

    # Extract out just the new parts from the full_file_training_func
					lowercase		      =		[]
					lowercase		      =		[]  # We keep track of the idxs just in case it's a repeated statement
					for i, line in enumerate(lowerCAmelCase__						):
										if i not in passed_idxs:
															if (line not in full_file_func) and (line.lstrip() != _dl_line):
																				if "TESTING_MOCKED_DATALOADERS" not in line:
																									new_full_example_parts.append(lowerCAmelCase__						)
																									passed_idxs.append(lowerCAmelCase__						)

    # Finally, get the overall diff
					lowercase		      =		[line for line in new_feature_code if line not in new_full_example_parts]
					if secondary_filename is not None:
										lowercase		      =		[line for line in full_file_contents if line not in secondary_file_func]
										lowercase		      =		[line for line in diff_from_example if line not in diff_from_two]

					return diff_from_example




