code: def calc_action_log_probs(
      logits: torch.Tensor,
      sequences: torch.LongTensor,
      num_actions: int,
  ) -> torch.Tensor:
      """Calculate action log probs.
  
      Args:
          output (torch.Tensor): Output tensor of Actor.forward.logits.
          sequences (torch.LongTensor): Input sequences.
          num_actions (int): Number of actions.
  
      Returns:
          torch.Tensor: Action log probs.
      """
      log_probs = _log_probs_from_logits(
          logits[:, :-1, :], sequences[:, 1:]
      )
      return log_probs[:, -num_actions:]
  
file_path: ColossalAI/applications/Chat/coati/models/utils.py
imports: from typing import Optional, Union
  import torch
  import torch.nn.functional
label_desc: Use image node_id 4 for calling a global function with example usage: calc_action_log_probs(logits, sequences, num_actions) and returns: log_probs