code: def compute_sequence_bias_grad_sample(
      layer: SequenceBias,
      activations: List[torch.Tensor],
      backprops: torch.Tensor,
  ) -> Dict[nn.Parameter, torch.Tensor]:
      """
      Computes per sample gradients for ``SequenceBias`` layer
  
      Args:
          layer: Layer
          activations: Activations
          backprops: Backpropagations
      """
      ret = {}
      if layer.bias.requires_grad:
          ret[layer.bias] = backprops[:, -1]
      return ret
  
imports: from typing import Dict, List
  import torch
  import torch.nn
  from opacus.layers.dp_multihead_attention import SequenceBias
  from .utils import register_grad_sampler
label_desc: Use image node_id 1 for calling a global function with example usage: compute_sequence_bias_grad_sample(layer, activations, backprops) and returns: ret