code: def compute_sequence_probability(
      sequence_probabilities: np.ndarray,
      max_sequence_length: Optional[int] = None,
      return_log_prob: bool = True,
  ) -> float:
      """Computes the sequence level probability.
  
      Args:
          sequence_probabilities: An iterable of iterables or np.ndarray with shape (sequence_length,)
          max_sequence_length: The maximum sequence length to use. If None, uses the first dim of `sequence_probabilities`
          return_log_prob: Whether to return the log probability. Defaults to True.
      """
      if max_sequence_length is None:
          max_sequence_length = sequence_probabilities.shape[0]
  
      sequence_probabilities = sequence_probabilities[
          :max_sequence_length
      ]
  
      if return_log_prob:
          return np.sum(np.log(sequence_probabilities))
      else:
          return np.prod(sequence_probabilities)
  
imports: import re
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from ludwig.constants import NAME, PREPROCESSING, SEQUENCE, TEXT, TIMESERIES, TYPE
  from ludwig.utils.data_utils import hash_dict
  from ludwig.utils.strings_utils import get_tokenizer_from_registry, UNKNOWN_SYMBOL
label_desc: Use image node_id 4 for calling a global function with example usage: compute_sequence_probability(sequence_probabilities, max_sequence_length, return_log_prob) and returns: np, np