class_docstr: Computes scaled dot-product attention using a Python implementation.
class_docstr_tok: ["Computes","scaled","dot-product","attention","using","a","Python","implementation","."]
code: def forward(
      self,
      seqs: Tensor,
      keys: Tensor,
      key_padding_mask: Optional[PaddingMask],
      values: Tensor,
      *,
      attn_mask: Optional[AttentionMask] = None,
      needs_weights: bool = False,
  ) -> Tuple[Tensor, Optional[Tensor]]:
      return _naive_scaled_dot_product_attention(
          seqs,
          keys,
          key_padding_mask,
          values,
          attn_mask,
          self.attn_dropout_p,
          needs_weights,
          self.training,
      )
  
imports: import logging
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from typing import Generator, Optional, Protocol, Tuple, final
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.functional import dropout, softmax
  from fairseq2.nn.padding import PaddingMask
  from fairseq2.nn.transformer.attention_mask import AttentionMask, CausalAttentionMask
  from fairseq2.typing import finaloverride
label_desc: Use image node_id 2 for calling the NaiveSDPA obj's underlying member method code with example usage: obj.forward(seqs, keys, key_padding_mask, values) and returns: _naive_scaled_dot_product_attention