docstr: ivy.Container instance method variant of
  ivy.scaled_dot_product_attention. This method simply wraps the
  function, and so the docstring for ivy.scaled_dot_product_attention
  also applies to this method with minimal changes.
  
  Parameters
  ----------
  self
      The queries input container. The shape of queries input array leaves should
      be in *[batch_shape,num_queries,feat_dim]*. The queries input array leaves
      should have the same size as keys and values.
  key
      The keys input array container. The shape of keys input array leaves
      should be in *[batch_shape,num_keys,feat_dim]*. The keys input array
      leaves should have the same size as queries and values.
  value
      The values input array container. The shape of values input array
      leaves should be in *[batch_shape,num_keys,feat_dim]*. The values
      input array leaves should have the same size as queries and keys.
  scale
      The scale float value.
      The scale float value is used to scale the query-key pairs before softmax.
  mask
      The mask input array/container. The mask to apply to the query-key values.
      Default is None. The shape of mask input array leaves should be in
      *[batch_shape,num_queries,num_keys]*.
  dropout_p
      Specifies the dropout probability, if greater than 0.0, dropout is applied
  is_causal
      If true, assumes causal attention masking and errors if both `mask` and
      `is_causal` are set.
  training
      If True, dropout is used, otherwise dropout is not activated.
  key_chains
      The key-chains to apply or not apply the method to. Default is ``None``.
  to_apply
      If True, the method will be applied to key_chains, otherwise key_chains
      will be skipped. Default is ``True``.
  prune_unapplied
      Whether to prune key_chains for which the function was not applied.
      Default is ``False``.
  map_sequences
      Whether to also map method to sequences (lists, tuples).
      Default is ``False``.
  out
      optional output array, for writing the result to. It must have a shape
      that the inputs broadcast to.
  
  Returns
  -------
  ret
      The output container following applications of scaled dot-product
      attention. The output array is the weighted sum produced by the
      attention score and value. The shape of output array is
      *[batch_shape,num_queries,feat_dim]* .
  
  Examples
  --------
  With :class:`ivy.Container` input:
  
  >>> q = ivy.Container(a=ivy.array([[[0.2, 1.], [2.7, 3.], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[1.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
  >>> k = ivy.Container(a=ivy.array([[[4.2, 1.], [2.2, 3.3], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[3.2, 1.], [2.2, 3.6], [4.0, 5.6]]]))
  
  >>> v = ivy.Container(a=ivy.array([[[5.2, 1.], [2.1, 3.], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[0.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
  >>> result = ivy.scaled_dot_product_attention(q, k, v, scale=1, dropout_p=0.1,
  ...                                           is_causal=True, training=True)
  >>> print(result)
  {
      a: ivy.array([[[5.19999981, 1.],
                     [2.59249449, 2.68226194],
                     [4.4000001, 5.5999999]]]),
      b: ivy.array([[[0.2, 1.],
                     [2.19603825, 2.9960382],
                     [4.4000001, 5.5999999]]])
  }
  
  >>> q = ivy.Container(a=ivy.array([[[0.2, 1.], [2.7, 3.], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[1.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
  >>> k = ivy.Container(a=ivy.array([[[4.2, 1.], [2.2, 3.3], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[3.2, 1.], [2.2, 3.6], [4.0, 5.6]]]))
  >>> v = ivy.Container(a=ivy.array([[[5.2, 1.], [2.1, 3.], [4.4, 5.6]]]),
  ...                   b=ivy.array([[[0.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
  >>> mask =
  ... ivy.Container(a=ivy.array([[[1.0, 1.0, 1.0],
  ...                             [1.0, 1.0, 1.0],
  ...                             [1.0, 1.0, 1.0]]]),
  ...               b=ivy.array([[[1.0, 1.0, 1.0],
  ...                             [1.0, 1.0, 1.0],
  ...                             [1.0, 1.0,1.0]]]))
  >>> result = ivy.scaled_dot_product_attention(q,k,v,scale=1,mask=mask)
  >>> print(result)
  {
      a: ivy.array([[[4.26894283, 5.40236187],
                     [4.39999437, 5.59999037],
                     [4.4000001, 5.5999999]]]),
      b: ivy.array([[[4.35046196, 5.54282808],
                     [4.39989519, 5.5998764],
                     [4.4000001, 5.5999999]]])
  
  }
docstr_tok: ["ivy.Container","instance","method","variant","of","ivy.scaled_dot_product_attention",".","This","method","simply","wraps","the","function",",","and","so","the","docstring","for","ivy.scaled_dot_product_attention","also","applies","to","this","method","with","minimal","changes",".","Parameters","--","--","--","--","--","self","The","queries","input","container",".","The","shape","of","queries","input","array","leaves","should","be","in","*","[","batch_shape",",","num_queries",",","feat_dim","]","*",".","The","queries","input","array","leaves","should","have","the","same","size","as","keys","and","values",".","key","The","keys","input","array","container",".","The","shape","of","keys","input","array","leaves","should","be","in","*","[","batch_shape",",","num_keys",",","feat_dim","]","*",".","The","keys","input","array","leaves","should","have","the","same","size","as","queries","and","values",".","value","The","values","input","array","container",".","The","shape","of","values","input","array","leaves","should","be","in","*","[","batch_shape",",","num_keys",",","feat_dim","]","*",".","The","values","input","array","leaves","should","have","the","same","size","as","queries","and","keys",".","scale","The","scale","float","value",".","The","scale","float","value","is","used","to","scale","the","query-key","pairs","before","softmax",".","mask","The","mask","input","array\/container",".","The","mask","to","apply","to","the","query-key","values",".","Default","is","None",".","The","shape","of","mask","input","array","leaves","should","be","in","*","[","batch_shape",",","num_queries",",","num_keys","]","*",".","dropout_p","Specifies","the","dropout","probability",",","if","greater","than","0.0",",","dropout","is","applied","is_causal","If","true",",","assumes","causal","attention","masking","and","errors","if","both","`","mask","`","and","`","is_causal","`","are","set",".","training","If","True",",","dropout","is","used",",","otherwise","dropout","is","not","activated",".","key_chains","The","key-chains","to","apply","or","not","apply","the","method","to",".","Default","is","``","None","``",".","to_apply","If","True",",","the","method","will","be","applied","to","key_chains",",","otherwise","key_chains","will","be","skipped",".","Default","is","``","True","``",".","prune_unapplied","Whether","to","prune","key_chains","for","which","the","function","was","not","applied",".","Default","is","``","False","``",".","map_sequences","Whether","to","also","map","method","to","sequences","(","lists",",","tuples",")",".","Default","is","``","False","``",".","out","optional","output","array",",","for","writing","the","result","to",".","It","must","have","a","shape","that","the","inputs","broadcast","to",".","Returns","--","--","--","-","ret","The","output","container","following","applications","of","scaled","dot-product","attention",".","The","output","array","is","the","weighted","sum","produced","by","the","attention","score","and","value",".","The","shape","of","output","array","is","*","[","batch_shape",",","num_queries",",","feat_dim","]","*",".","Examples","--","--","--","--","With",":","class",":","`","ivy.Container","`","input",":",">",">",">","q","=","ivy.Container","(","a=ivy.array","(","[","[","[","0.2",",","1",".","]",",","[","2.7",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","1.2",",","1",".","]",",","[","2.2",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",")",">",">",">","k","=","ivy.Container","(","a=ivy.array","(","[","[","[","4.2",",","1",".","]",",","[","2.2",",","3.3","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","3.2",",","1",".","]",",","[","2.2",",","3.6","]",",","[","4.0",",","5.6","]","]","]",")",")",">",">",">","v","=","ivy.Container","(","a=ivy.array","(","[","[","[","5.2",",","1",".","]",",","[","2.1",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","0.2",",","1",".","]",",","[","2.2",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",")",">",">",">","result","=","ivy.scaled_dot_product_attention","(","q",",","k",",","v",",","scale=1",",","dropout_p=0.1",",","...","is_causal=True",",","training=True",")",">",">",">","print","(","result",")","{","a",":","ivy.array","(","[","[","[","5.19999981",",","1",".","]",",","[","2.59249449",",","2.68226194","]",",","[","4.4000001",",","5.5999999","]","]","]",")",",","b",":","ivy.array","(","[","[","[","0.2",",","1",".","]",",","[","2.19603825",",","2.9960382","]",",","[","4.4000001",",","5.5999999","]","]","]",")","}",">",">",">","q","=","ivy.Container","(","a=ivy.array","(","[","[","[","0.2",",","1",".","]",",","[","2.7",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","1.2",",","1",".","]",",","[","2.2",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",")",">",">",">","k","=","ivy.Container","(","a=ivy.array","(","[","[","[","4.2",",","1",".","]",",","[","2.2",",","3.3","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","3.2",",","1",".","]",",","[","2.2",",","3.6","]",",","[","4.0",",","5.6","]","]","]",")",")",">",">",">","v","=","ivy.Container","(","a=ivy.array","(","[","[","[","5.2",",","1",".","]",",","[","2.1",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",",","...","b=ivy.array","(","[","[","[","0.2",",","1",".","]",",","[","2.2",",","3",".","]",",","[","4.4",",","5.6","]","]","]",")",")",">",">",">","mask","=","...","ivy.Container","(","a=ivy.array","(","[","[","[","1.0",",","1.0",",","1.0","]",",","...","[","1.0",",","1.0",",","1.0","]",",","...","[","1.0",",","1.0",",","1.0","]","]","]",")",",","...","b=ivy.array","(","[","[","[","1.0",",","1.0",",","1.0","]",",","...","[","1.0",",","1.0",",","1.0","]",",","...","[","1.0",",","1.0,1.0","]","]","]",")",")",">",">",">","result","=","ivy.scaled_dot_product_attention","(","q",",","k",",","v",",","scale=1",",","mask=mask",")",">",">",">","print","(","result",")","{","a",":","ivy.array","(","[","[","[","4.26894283",",","5.40236187","]",",","[","4.39999437",",","5.59999037","]",",","[","4.4000001",",","5.5999999","]","]","]",")",",","b",":","ivy.array","(","[","[","[","4.35046196",",","5.54282808","]",",","[","4.39989519",",","5.5998764","]",",","[","4.4000001",",","5.5999999","]","]","]",")","}"]
code: def scaled_dot_product_attention(
      self: ivy.Container,
      key: Union[ivy.Array, ivy.NativeArray, ivy.Container],
      value: Union[ivy.Array, ivy.NativeArray, ivy.Container],
      /,
      *,
      scale: Union[float, ivy.Container],
      mask: Optional[
          Union[ivy.Array, ivy.NativeArray, ivy.Container]
      ] = None,
      dropout_p: Optional[float] = 0.0,
      is_causal: Optional[bool] = False,
      training: Optional[bool] = False,
      key_chains: Optional[
          Union[List[str], Dict[str, str], ivy.Container]
      ] = None,
      to_apply: Union[bool, ivy.Container] = True,
      prune_unapplied: Union[bool, ivy.Container] = False,
      map_sequences: Union[bool, ivy.Container] = False,
      out: Optional[ivy.Container] = None,
  ) -> ivy.Container:
      """ivy.Container instance method variant of
      ivy.scaled_dot_product_attention. This method simply wraps the
      function, and so the docstring for ivy.scaled_dot_product_attention
      also applies to this method with minimal changes.
  
      Parameters
      ----------
      self
          The queries input container. The shape of queries input array leaves should
          be in *[batch_shape,num_queries,feat_dim]*. The queries input array leaves
          should have the same size as keys and values.
      key
          The keys input array container. The shape of keys input array leaves
          should be in *[batch_shape,num_keys,feat_dim]*. The keys input array
          leaves should have the same size as queries and values.
      value
          The values input array container. The shape of values input array
          leaves should be in *[batch_shape,num_keys,feat_dim]*. The values
          input array leaves should have the same size as queries and keys.
      scale
          The scale float value.
          The scale float value is used to scale the query-key pairs before softmax.
      mask
          The mask input array/container. The mask to apply to the query-key values.
          Default is None. The shape of mask input array leaves should be in
          *[batch_shape,num_queries,num_keys]*.
      dropout_p
          Specifies the dropout probability, if greater than 0.0, dropout is applied
      is_causal
          If true, assumes causal attention masking and errors if both `mask` and
          `is_causal` are set.
      training
          If True, dropout is used, otherwise dropout is not activated.
      key_chains
          The key-chains to apply or not apply the method to. Default is ``None``.
      to_apply
          If True, the method will be applied to key_chains, otherwise key_chains
          will be skipped. Default is ``True``.
      prune_unapplied
          Whether to prune key_chains for which the function was not applied.
          Default is ``False``.
      map_sequences
          Whether to also map method to sequences (lists, tuples).
          Default is ``False``.
      out
          optional output array, for writing the result to. It must have a shape
          that the inputs broadcast to.
  
      Returns
      -------
      ret
          The output container following applications of scaled dot-product
          attention. The output array is the weighted sum produced by the
          attention score and value. The shape of output array is
          *[batch_shape,num_queries,feat_dim]* .
  
      Examples
      --------
      With :class:`ivy.Container` input:
  
      >>> q = ivy.Container(a=ivy.array([[[0.2, 1.], [2.7, 3.], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[1.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
      >>> k = ivy.Container(a=ivy.array([[[4.2, 1.], [2.2, 3.3], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[3.2, 1.], [2.2, 3.6], [4.0, 5.6]]]))
  
      >>> v = ivy.Container(a=ivy.array([[[5.2, 1.], [2.1, 3.], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[0.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
      >>> result = ivy.scaled_dot_product_attention(q, k, v, scale=1, dropout_p=0.1,
      ...                                           is_causal=True, training=True)
      >>> print(result)
      {
          a: ivy.array([[[5.19999981, 1.],
                         [2.59249449, 2.68226194],
                         [4.4000001, 5.5999999]]]),
          b: ivy.array([[[0.2, 1.],
                         [2.19603825, 2.9960382],
                         [4.4000001, 5.5999999]]])
      }
  
      >>> q = ivy.Container(a=ivy.array([[[0.2, 1.], [2.7, 3.], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[1.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
      >>> k = ivy.Container(a=ivy.array([[[4.2, 1.], [2.2, 3.3], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[3.2, 1.], [2.2, 3.6], [4.0, 5.6]]]))
      >>> v = ivy.Container(a=ivy.array([[[5.2, 1.], [2.1, 3.], [4.4, 5.6]]]),
      ...                   b=ivy.array([[[0.2, 1.], [2.2, 3.], [4.4, 5.6]]]))
      >>> mask =
      ... ivy.Container(a=ivy.array([[[1.0, 1.0, 1.0],
      ...                             [1.0, 1.0, 1.0],
      ...                             [1.0, 1.0, 1.0]]]),
      ...               b=ivy.array([[[1.0, 1.0, 1.0],
      ...                             [1.0, 1.0, 1.0],
      ...                             [1.0, 1.0,1.0]]]))
      >>> result = ivy.scaled_dot_product_attention(q,k,v,scale=1,mask=mask)
      >>> print(result)
      {
          a: ivy.array([[[4.26894283, 5.40236187],
                         [4.39999437, 5.59999037],
                         [4.4000001, 5.5999999]]]),
          b: ivy.array([[[4.35046196, 5.54282808],
                         [4.39989519, 5.5998764],
                         [4.4000001, 5.5999999]]])
  
      }
      """
      return self._static_scaled_dot_product_attention(
          self,
          key,
          value,
          scale=scale,
          mask=mask,
          dropout_p=dropout_p,
          is_causal=is_causal,
          training=training,
          key_chains=key_chains,
          to_apply=to_apply,
          prune_unapplied=prune_unapplied,
          map_sequences=map_sequences,
          out=out,
      )
  
imports: from typing import Optional, Tuple, Union, List, Callable, Dict, Sequence
  from ivy.data_classes.container.base import ContainerBase
  import ivy
label_desc: Use image node_id 12 for calling the _ContainerWithLayers obj's underlying member method code with example usage: obj.scaled_dot_product_attention() and returns: self