parameters: (self, dropout=0.0)
docstring: r"""Processes a projected query and key-value pair to apply
          scaled dot product attention.
          Args:
              dropout (float): probability of dropping an attention weight.
          Examples::
              >>> SDP = torchtext.models.ScaledDotProduct(0.1)
              >>> q = torch.randn(256, 21, 3)
              >>> k = v = torch.randn(256, 21, 3)
              >>> attn_output, attn_weights = SDP(q, k, v)
              >>> print(attn_output.shape, attn_weights.shape)
              torch.Size([256, 21, 3]) torch.Size([256, 21, 21])
docstring_summary: r"""Processes a projected query and key-value pair to apply
          scaled dot product attention.
          Args:
              dropout (float): probability of dropping an attention weight.
          Examples::
              >>> SDP = torchtext.models.ScaledDotProduct(0.1)
              >>> q = torch.randn(256, 21, 3)
              >>> k = v = torch.randn(256, 21, 3)
              >>> attn_output, attn_weights = SDP(q, k, v)
              >>> print(attn_output.shape, attn_weights.shape)
              torch.Size([256, 21, 3]) torch.Size([256, 21, 21])
docstring_tokens: r Processes a projected query and key - value pair to apply scaled dot product attention . Args : dropout ( float ) : probability of dropping an attention weight . Examples :: >>> SDP = torchtext . models . ScaledDotProduct ( 0 . 1 ) >>> q = torch . randn ( 256 21 3 ) >>> k = v = torch . randn ( 256 21 3 ) >>> attn_output attn_weights = SDP ( q k v ) >>> print ( attn_output . shape attn_weights . shape ) torch . Size ( [ 256 21 3 ] ) torch . Size ( [ 256 21 21 ] )
function: def __init__(self, dropout=0.0):
          r"""Processes a projected query and key-value pair to apply
          scaled dot product attention.
          Args:
              dropout (float): probability of dropping an attention weight.
          Examples::
              >>> SDP = torchtext.models.ScaledDotProduct(0.1)
              >>> q = torch.randn(256, 21, 3)
              >>> k = v = torch.randn(256, 21, 3)
              >>> attn_output, attn_weights = SDP(q, k, v)
              >>> print(attn_output.shape, attn_weights.shape)
              torch.Size([256, 21, 3]) torch.Size([256, 21, 21])
          """
          super(ScaledDotProduct, self).__init__()
          self.dropout = dropout
function_tokens: def __init__ ( self , dropout = 0.0 ) : super ( ScaledDotProduct , self ) . __init__ ( ) self . dropout = dropout