code: def scaled_dot_product_attention(
      self,
      query,
      key,
      value,
      attn_mask=None,
      dropout_p=0.0,
      is_causal=False,
      scale=None,
      getattn=False,
  ) -> torch.Tensor:
      # Efficient implementation equivalent to the following:
      L, S = query.size(-2), key.size(-2)
      scale_factor = (
          1 / math.sqrt(query.size(-1)) if scale is None else scale
      )
      attn_bias = torch.zeros(
          L, S, dtype=query.dtype, device=self.device
      )
      if is_causal:
          assert attn_mask is None
          temp_mask = torch.ones(L, S, dtype=torch.bool).tril(
              diagonal=0
          )
          attn_bias.masked_fill_(temp_mask.logical_not(), float("-inf"))
          attn_bias.to(query.dtype)
  
      if attn_mask is not None:
          if attn_mask.dtype == torch.bool:
              attn_mask.masked_fill_(
                  attn_mask.logical_not(), float("-inf")
              )
          else:
              attn_bias += attn_mask
      attn_weight = query @ key.transpose(-2, -1) * scale_factor
      attn_weight += attn_bias
      attn_weight = torch.softmax(attn_weight, dim=-1)
      if getattn:
          get_attn_maps(self, attn_weight)
      attn_weight = torch.dropout(attn_weight, dropout_p, train=True)
      return attn_weight @ value
  
imports: import math
  from typing import Dict, Optional
  import torch
  import torchvision.transforms.functional
  from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer
  from diffusers import StableDiffusionPipeline
  from diffusers.models import AutoencoderKL, UNet2DConditionModel
  from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
  from diffusers.schedulers import KarrasDiffusionSchedulers
  from diffusers.utils import USE_PEFT_BACKEND
label_desc: Use image node_id 10 for calling a global function with example usage: scaled_dot_product_attention(query, key, value, attn_mask, dropout_p, is_causal, scale, getattn) and returns: unknown