class_docstr: Average attention.
  See "Accelerating Neural Transformer via an Average Attention Network"
  for more details.
code: def _forward_incremental(
      self, value, mask_trick, mask_future_timesteps, incremental_state
  ):
      if mask_trick:
          saved_state = self._get_input_buffer(incremental_state)
          if "prev_vec" in saved_state:
              value = torch.cat([saved_state["prev_vec"], value], dim=0)
          saved_state["prev_vec"] = value
          self._set_input_buffer(incremental_state, saved_state)
          attn_weights = None
          attn = value.mean(0, keepdim=True)
      else:
          saved_state = self._get_input_buffer(incremental_state)
          if "prev_sum" in saved_state:
              prev_sum = saved_state["prev_sum"]
              if len(prev_sum) == 2:
                  # for tracing, prev_sum does not have sequence axis
                  prev_sum = prev_sum.unsqueeze(0)
              pos = saved_state["prev_pos"] + 1
              curr_sum = prev_sum + value
              attn = curr_sum / pos
          else:
              curr_sum = value
              attn = value
              pos = 1
          saved_state["prev_sum"] = curr_sum
          saved_state["prev_pos"] = pos
          self._set_input_buffer(incremental_state, saved_state)
          attn_weights = None
      return attn, attn_weights
  
imports: import torch
  import torch.nn.functional
  from fairseq import utils
  from fairseq.incremental_decoding_utils import with_incremental_state
  from torch import nn
label_desc: Use image node_id 4 for calling the AverageAttention obj's underlying member method code with example usage: obj._forward_incremental(value, mask_trick, mask_future_timesteps, incremental_state) and returns: attn,  attn_weights