code: def _compute_log_determinant(cov: Tensor, q: int) -> Tensor:
      r"""Computes the sum of the log determinants of a block diagonal covariance
      matrices averaged over the Pareto samples.
  
      Args:
          cov: A `batch_shape x num_pareto_samples x num_outputs x (q + P) x (q + P)`
              -dim Tensor containing the covariance matrices.
          q: The batch size.
  
      Return:
          log_det_cov: A `batch_shape`-dim Tensor containing the sum of the
              determinants for each output.
      """
      log_det_cov = torch.logdet(cov[..., 0:q, 0:q])
      check_no_nans(log_det_cov)
  
      return log_det_cov.sum(dim=-1).mean(dim=-1)
  
imports: from __future__ import annotations
  from typing import Any, Optional, Tuple
  import torch
  from botorch.acquisition.acquisition import AcquisitionFunction
  from botorch.exceptions import InputDataError
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.model import Model
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.utils import check_no_nans
  from botorch.utils.transforms import concatenate_pending_points, t_batch_mode_transform
  from torch import Tensor
  from torch.distributions import Normal
label_desc: Use image node_id 12 for calling a global function with example usage: _compute_log_determinant(cov, q) and returns: log_det_cov