

from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
import torch
from transformers import CLIPImageProcessor, CLIPVisionModel

from ...models import PriorTransformer
from ...pipelines import DiffusionPipeline
from ...schedulers import HeunDiscreteScheduler
from ...utils import (
    BaseOutput,
    is_accelerate_available,
    logging,
    randn_tensor,
    replace_example_docstring,
)
from .renderer import ShapERenderer


__lowercase     : List[Any]       =						logging.get_logger(__name__)  # pylint: disable=invalid-name

__lowercase     : Tuple       =						'''\n    Examples:\n        ```py\n        >>> from PIL import Image\n        >>> import torch\n        >>> from diffusers import DiffusionPipeline\n        >>> from diffusers.utils import export_to_gif, load_image\n\n        >>> device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n        >>> repo = \"openai/shap-e-img2img\"\n        >>> pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16)\n        >>> pipe = pipe.to(device)\n\n        >>> guidance_scale = 3.0\n        >>> image_url = \"https://hf.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi.png\"\n        >>> image = load_image(image_url).convert(\"RGB\")\n\n        >>> images = pipe(\n        ...     image,\n        ...     guidance_scale=guidance_scale,\n        ...     num_inference_steps=64,\n        ...     frame_size=256,\n        ... ).images\n\n        >>> gif_path = export_to_gif(images[0], \"corgi_3d.gif\")\n        ```\n'''



@dataclass
class 						_A     (				snake_case				):





  '''simple docstring'''



  __lowerCamelCase			:      Union[PIL.Image.Image, np.ndarray]







class 						_A     (				snake_case				):





  '''simple docstring'''



  def __init__(  self   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,):

      '''simple docstring'''
      super().__init__()

      self.register_modules(
          prior=SCREAMING_SNAKE_CASE_   ,image_encoder=SCREAMING_SNAKE_CASE_   ,image_processor=SCREAMING_SNAKE_CASE_   ,scheduler=SCREAMING_SNAKE_CASE_   ,renderer=SCREAMING_SNAKE_CASE_   ,)





  def    snake_case_       (  self   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    ):

      '''simple docstring'''



      if latents is None:
          snake_case							:		Optional[int]        =		randn_tensor(SCREAMING_SNAKE_CASE_   ,generator=SCREAMING_SNAKE_CASE_   ,device=SCREAMING_SNAKE_CASE_   ,dtype=SCREAMING_SNAKE_CASE_    )
      else:
          if latents.shape != shape:
              raise ValueError(F"""Unexpected latents shape, got {latents.shape}, expected {shape}"""    )
          snake_case							:		Union[str, Any]        =		latents.to(SCREAMING_SNAKE_CASE_    )

      snake_case							:		Tuple        =		latents * scheduler.init_noise_sigma
      return latents





  def    snake_case_       (  self   ,SCREAMING_SNAKE_CASE_=0    ):

      '''simple docstring'''



      if is_accelerate_available():
          from accelerate import cpu_offload
      else:
          raise ImportError("""Please install accelerate via `pip install accelerate`"""    )

      snake_case							:		Dict        =		torch.device(F"""cuda:{gpu_id}"""    )

      snake_case							:		Union[str, Any]        =		[self.image_encoder, self.prior]
      for cpu_offloaded_model in models:
          if cpu_offloaded_model is not None:
              cpu_offload(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    )





  @property
  def    snake_case_       (  self    ):

      '''simple docstring'''



      if self.device != torch.device("""meta"""    ) or not hasattr(self.image_encoder   ,"""_hf_hook"""    ):
          return self.device
      for module in self.image_encoder.modules():
          if (
              hasattr(SCREAMING_SNAKE_CASE_   ,"""_hf_hook"""    )
              and hasattr(module._hf_hook   ,"""execution_device"""    )
              and module._hf_hook.execution_device is not None
          ):
              return torch.device(module._hf_hook.execution_device    )
      return self.device





  def    snake_case_       (  self   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,):

      '''simple docstring'''



      if isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    ) and isinstance(image[0]   ,torch.Tensor    ):
          snake_case							:		Tuple        =		torch.cat(SCREAMING_SNAKE_CASE_   ,axis=0    ) if image[0].ndim == 4 else torch.stack(SCREAMING_SNAKE_CASE_   ,axis=0    )

      if not isinstance(SCREAMING_SNAKE_CASE_   ,torch.Tensor    ):
          snake_case							:		Dict        =		self.image_processor(SCREAMING_SNAKE_CASE_   ,return_tensors="""pt"""    ).pixel_values[0].unsqueeze(0    )

      snake_case							:		Optional[int]        =		image.to(dtype=self.image_encoder.dtype   ,device=SCREAMING_SNAKE_CASE_    )

      snake_case							:		Optional[int]        =		self.image_encoder(SCREAMING_SNAKE_CASE_    )["""last_hidden_state"""]
      snake_case							:		Tuple        =		image_embeds[:, 1:, :].contiguous()  # batch_size, dim, 256

      snake_case							:		Union[str, Any]        =		image_embeds.repeat_interleave(SCREAMING_SNAKE_CASE_   ,dim=0    )

      if do_classifier_free_guidance:
          snake_case							:		int        =		torch.zeros_like(SCREAMING_SNAKE_CASE_    )

          # For classifier free guidance, we need to do two forward passes.
          # Here we concatenate the unconditional and text embeddings into a single batch
          # to avoid doing two forward passes
          snake_case							:		Optional[int]        =		torch.cat([negative_image_embeds, image_embeds]    )

      return image_embeds





  @torch.no_grad()
  @replace_example_docstring(SCREAMING_SNAKE_CASE_    )
  def __call__(  self   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_ = 1   ,SCREAMING_SNAKE_CASE_ = 25   ,SCREAMING_SNAKE_CASE_ = None   ,SCREAMING_SNAKE_CASE_ = None   ,SCREAMING_SNAKE_CASE_ = 4.0   ,SCREAMING_SNAKE_CASE_ = 64   ,SCREAMING_SNAKE_CASE_ = "pil"   ,SCREAMING_SNAKE_CASE_ = True   ,):

      '''simple docstring'''



      if isinstance(SCREAMING_SNAKE_CASE_   ,PIL.Image.Image    ):
          snake_case							:		Union[str, Any]        =		1
      elif isinstance(SCREAMING_SNAKE_CASE_   ,torch.Tensor    ):
          snake_case							:		List[str]        =		image.shape[0]
      elif isinstance(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    ) and isinstance(image[0]   ,(torch.Tensor, PIL.Image.Image)    ):
          snake_case							:		Any        =		len(SCREAMING_SNAKE_CASE_    )
      else:
          raise ValueError(
              F"""`image` has to be of type `PIL.Image.Image`, `torch.Tensor`, `List[PIL.Image.Image]` or `List[torch.Tensor]` but is {type(SCREAMING_SNAKE_CASE_    )}"""    )

      snake_case							:		Tuple        =		self._execution_device

      snake_case							:		Optional[int]        =		batch_size * num_images_per_prompt

      snake_case							:		Tuple        =		guidance_scale > 1.0
      snake_case							:		List[str]        =		self._encode_image(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    )

      # prior

      self.scheduler.set_timesteps(SCREAMING_SNAKE_CASE_   ,device=SCREAMING_SNAKE_CASE_    )
      snake_case							:		Optional[Any]        =		self.scheduler.timesteps

      snake_case							:		Optional[int]        =		self.prior.config.num_embeddings
      snake_case							:		int        =		self.prior.config.embedding_dim

      snake_case							:		Any        =		self.prepare_latents(
          (batch_size, num_embeddings * embedding_dim)   ,image_embeds.dtype   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_   ,self.scheduler   ,)

      # YiYi notes: for testing only to match ldm, we can directly create a latents with desired shape: batch_size, num_embeddings, embedding_dim
      snake_case							:		Union[str, Any]        =		latents.reshape(latents.shape[0]   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    )

      for i, t in enumerate(self.progress_bar(SCREAMING_SNAKE_CASE_    )    ):
          # expand the latents if we are doing classifier free guidance
          snake_case							:		Union[str, Any]        =		torch.cat([latents] * 2    ) if do_classifier_free_guidance else latents
          snake_case							:		Optional[Any]        =		self.scheduler.scale_model_input(SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    )

          snake_case							:		Optional[int]        =		self.prior(
              SCREAMING_SNAKE_CASE_   ,timestep=SCREAMING_SNAKE_CASE_   ,proj_embedding=SCREAMING_SNAKE_CASE_   ,).predicted_image_embedding

          # remove the variance
          snake_case      ,		snake_case							:		Union[str, Any]        =		noise_pred.split(
              scaled_model_input.shape[2]   ,dim=2    )  # batch_size, num_embeddings, embedding_dim

          if do_classifier_free_guidance is not None:
              snake_case      ,		snake_case							:		List[Any]        =		noise_pred.chunk(2    )
              snake_case							:		Dict        =		noise_pred_uncond + guidance_scale * (noise_pred - noise_pred_uncond)

          snake_case							:		Dict        =		self.scheduler.step(
              SCREAMING_SNAKE_CASE_   ,timestep=SCREAMING_SNAKE_CASE_   ,sample=SCREAMING_SNAKE_CASE_   ,).prev_sample

      if output_type == "latent":
          return ShapEPipelineOutput(images=SCREAMING_SNAKE_CASE_    )

      snake_case							:		Any        =		[]
      for i, latent in enumerate(SCREAMING_SNAKE_CASE_    ):
          print()
          snake_case							:		int        =		self.renderer.decode(
              latent[None, :]   ,SCREAMING_SNAKE_CASE_   ,size=SCREAMING_SNAKE_CASE_   ,ray_batch_size=4096   ,n_coarse_samples=64   ,n_fine_samples=128   ,)

          images.append(SCREAMING_SNAKE_CASE_    )

      snake_case							:		Dict        =		torch.stack(SCREAMING_SNAKE_CASE_    )

      if output_type not in ["np", "pil"]:
          raise ValueError(F"""Only the output types `pil` and `np` are supported not output_type={output_type}"""    )

      snake_case							:		Dict        =		images.cpu().numpy()

      if output_type == "pil":
          snake_case							:		Optional[Any]        =		[self.numpy_to_pil(SCREAMING_SNAKE_CASE_    ) for image in images]

      # Offload last model to CPU
      if hasattr(self   ,"""final_offload_hook"""    ) and self.final_offload_hook is not None:
          self.final_offload_hook.offload()

      if not return_dict:
          return (images,)

      return ShapEPipelineOutput(images=SCREAMING_SNAKE_CASE_    )








'''simple docstring'''





import unittest

from parameterized import parameterized

from transformers import OpenLlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch

  from transformers import OpenLlamaForCausalLM, OpenLlamaForSequenceClassification, OpenLlamaModel






class __A     :



 '''simple docstring'''







 def __init__(self					,  A					,  A=13					,  A=7					,  A=True					,  A=True					,  A=False					,  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=3					,  A=4					,  A=None					,  )       ->	str:


      """simple docstring"""



      _a           =    parent
      _a           =    batch_size
      _a           =    seq_length
      _a           =    is_training
      _a           =    use_input_mask
      _a           =    use_token_type_ids
      _a           =    use_labels
      _a           =    vocab_size
      _a           =    hidden_size
      _a           =    num_hidden_layers
      _a           =    num_attention_heads
      _a           =    intermediate_size
      _a           =    hidden_act
      _a           =    hidden_dropout_prob
      _a           =    attention_probs_dropout_prob
      _a           =    max_position_embeddings
      _a           =    type_vocab_size
      _a           =    type_sequence_label_size
      _a           =    initializer_range
      _a           =    num_labels
      _a           =    num_choices
      _a           =    scope



 def    a__    (self			)       ->	List[str]:


      """simple docstring"""



      _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
      if self.use_token_type_ids:
           _a           =    ids_tensor([self.batch_size, self.seq_length]					,  self.type_vocab_size			)

      _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           =    self.get_config()

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



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


      """simple docstring"""



      return OpenLlamaConfig(
          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					,  use_stable_embedding=A					,  )



 def    a__    (self					,  A					,  A					,  A					,  A					,  A					,  A					,  A			)       ->	Any:


      """simple docstring"""



      _a           =    OpenLlamaModel(config=A			)
      model.to(A			)
      model.eval()
      _a           =    model(A					,  attention_mask=A			)
      _a           =    model(A			)
      self.parent.assertEqual(result.last_hidden_state.shape					,  (self.batch_size, self.seq_length, self.hidden_size)			)



 def    a__    (self					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  )       ->	Any:


      """simple docstring"""



      _a           =    True
      _a           =    OpenLlamaModel(A			)
      model.to(A			)
      model.eval()
      _a           =    model(
          A					,  attention_mask=A					,  encoder_hidden_states=A					,  encoder_attention_mask=A					,  )
      _a           =    model(
          A					,  attention_mask=A					,  encoder_hidden_states=A					,  )
      _a           =    model(A					,  attention_mask=A			)
      self.parent.assertEqual(result.last_hidden_state.shape					,  (self.batch_size, self.seq_length, self.hidden_size)			)



 def    a__    (self					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  )       ->	Tuple:


      """simple docstring"""



      _a           =    OpenLlamaForCausalLM(config=A			)
      model.to(A			)
      model.eval()
      _a           =    model(A					,  attention_mask=A					,  labels=A			)
      self.parent.assertEqual(result.logits.shape					,  (self.batch_size, self.seq_length, self.vocab_size)			)



 def    a__    (self					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  A					,  )       ->	Dict:


      """simple docstring"""



      _a           =    True
      _a           =    True
      _a           =    OpenLlamaForCausalLM(config=A			)
      model.to(A			)
      model.eval()

      # first forward pass
      _a           =    model(
          A					,  attention_mask=A					,  encoder_hidden_states=A					,  encoder_attention_mask=A					,  use_cache=A					,  )
      _a           =    outputs.past_key_values

      # create hypothetical multiple next token and extent to next_input_ids
      _a           =    ids_tensor((self.batch_size, 3)					,  config.vocab_size			)
      _a           =    ids_tensor((self.batch_size, 3)					,  vocab_size=2			)

      # append to next input_ids and
      _a           =    torch.cat([input_ids, next_tokens]					,  dim=-1			)
      _a           =    torch.cat([input_mask, next_mask]					,  dim=-1			)

      _a           =    model(
          A					,  attention_mask=A					,  encoder_hidden_states=A					,  encoder_attention_mask=A					,  output_hidden_states=A					,  )['''hidden_states'''][0]
      _a           =    model(
          A					,  attention_mask=A					,  encoder_hidden_states=A					,  encoder_attention_mask=A					,  past_key_values=A					,  output_hidden_states=A					,  )['''hidden_states'''][0]

      # select random slice
      _a           =    ids_tensor((1,)					,  output_from_past.shape[-1]			).item()
      _a           =    output_from_no_past[:, -3:, random_slice_idx].detach()
      _a           =    output_from_past[:, :, random_slice_idx].detach()

      self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]			)

      # test that outputs are equal for slice
      self.parent.assertTrue(torch.allclose(A					,  A					,  atol=1E-3			)			)



 def    a__    (self			)       ->	Optional[Any]:


      """simple docstring"""



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






@require_torch
class __A     (    A  ,  A  ,  A  ,  unittest.TestCase		):



 '''simple docstring'''







 __lowerCamelCase       :			Optional[int]		=			(
     (OpenLlamaModel, OpenLlamaForCausalLM, OpenLlamaForSequenceClassification) if is_torch_available() else ()
 )
 __lowerCamelCase       :			Any		=			(OpenLlamaForCausalLM,) if is_torch_available() else ()
 __lowerCamelCase       :			List[Any]		=			(
     {
         'feature-extraction': OpenLlamaModel,
         'text-classification': OpenLlamaForSequenceClassification,
         'text-generation': OpenLlamaForCausalLM,
         'zero-shot': OpenLlamaForSequenceClassification,
     }
     if is_torch_available()
     else {}
 )
 __lowerCamelCase       :			List[str]		=			False
 __lowerCamelCase       :			List[str]		=			False



 def    a__    (self			)       ->	Tuple:


      """simple docstring"""



      _a           =    OpenLlamaModelTester(self			)
      _a           =    ConfigTester(self					,  config_class=A					,  hidden_size=37			)



 def    a__    (self			)       ->	List[str]:


      """simple docstring"""



      self.config_tester.run_common_tests()



 def    a__    (self			)       ->	Union[str, Any]:


      """simple docstring"""



      _a           =    self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*A			)



 def    a__    (self			)       ->	str:


      """simple docstring"""



      _a           =    self.model_tester.prepare_config_and_inputs()
      for type in ["absolute", "relative_key", "relative_key_query"]:
           _a           =    type
           self.model_tester.create_and_check_model(*A			)



 def    a__    (self			)       ->	Any:


      """simple docstring"""



      _a    ,       _a           =    self.model_tester.prepare_config_and_inputs_for_common()
      _a           =    3
      _a           =    input_dict['''input_ids''']
      _a           =    input_ids.ne(1			).to(A			)
      _a           =    ids_tensor([self.model_tester.batch_size]					,  self.model_tester.type_sequence_label_size			)
      _a           =    OpenLlamaForSequenceClassification(A			)
      model.to(A			)
      model.eval()
      _a           =    model(A					,  attention_mask=A					,  labels=A			)
      self.assertEqual(result.logits.shape					,  (self.model_tester.batch_size, self.model_tester.num_labels)			)



 def    a__    (self			)       ->	Dict:


      """simple docstring"""



      _a    ,       _a           =    self.model_tester.prepare_config_and_inputs_for_common()
      _a           =    3
      _a           =    '''single_label_classification'''
      _a           =    input_dict['''input_ids''']
      _a           =    input_ids.ne(1			).to(A			)
      _a           =    ids_tensor([self.model_tester.batch_size]					,  self.model_tester.type_sequence_label_size			)
      _a           =    OpenLlamaForSequenceClassification(A			)
      model.to(A			)
      model.eval()
      _a           =    model(A					,  attention_mask=A					,  labels=A			)
      self.assertEqual(result.logits.shape					,  (self.model_tester.batch_size, self.model_tester.num_labels)			)



 def    a__    (self			)       ->	Optional[Any]:


      """simple docstring"""



      _a    ,       _a           =    self.model_tester.prepare_config_and_inputs_for_common()
      _a           =    3
      _a           =    '''multi_label_classification'''
      _a           =    input_dict['''input_ids''']
      _a           =    input_ids.ne(1			).to(A			)
      _a           =    ids_tensor(
          [self.model_tester.batch_size, config.num_labels]					,  self.model_tester.type_sequence_label_size			).to(torch.float			)
      _a           =    OpenLlamaForSequenceClassification(A			)
      model.to(A			)
      model.eval()
      _a           =    model(A					,  attention_mask=A					,  labels=A			)
      self.assertEqual(result.logits.shape					,  (self.model_tester.batch_size, self.model_tester.num_labels)			)



 @unittest.skip('''Open-Llama buffers include complex numbers, which breaks this test'''			)
 def    a__    (self			)       ->	Optional[Any]:


      """simple docstring"""



      pass



 @parameterized.expand([('''linear''',), ('''dynamic''',)]			)
 def    a__    (self					,  A			)       ->	Optional[int]:


      """simple docstring"""



      _a    ,       _a           =    self.model_tester.prepare_config_and_inputs_for_common()
      _a           =    ids_tensor([1, 10]					,  config.vocab_size			)
      _a           =    ids_tensor([1, int(config.max_position_embeddings * 1.5			)]					,  config.vocab_size			)

      set_seed(42			)  # Fixed seed at init time so the two models get the same random weights
      _a           =    OpenLlamaModel(A			)
      original_model.to(A			)
      original_model.eval()
      _a           =    original_model(A			).last_hidden_state
      _a           =    original_model(A			).last_hidden_state

      set_seed(42			)  # Fixed seed at init time so the two models get the same random weights
      _a           =    {'''type''': scaling_type, '''factor''': 10.0}
      _a           =    OpenLlamaModel(A			)
      scaled_model.to(A			)
      scaled_model.eval()
      _a           =    scaled_model(A			).last_hidden_state
      _a           =    scaled_model(A			).last_hidden_state

      # Dynamic scaling does not change the RoPE embeddings until it receives an input longer than the original
      # maximum sequence length, so the outputs for the short input should match.
      if scaling_type == "dynamic":
           self.assertTrue(torch.allclose(A					,  A					,  atol=1E-5			)			)
      else:
           self.assertFalse(torch.allclose(A					,  A					,  atol=1E-5			)			)

      # The output should be different for long inputs
      self.assertFalse(torch.allclose(A					,  A					,  atol=1E-5			)			)



