code: def quantile_coverage_error(
      pred_dist: MultivariateNormal,
      test_y: torch.Tensor,
      quantile: float = 95.0,
  ):
      """
      Quantile coverage error.
      """
      if quantile <= 0 or quantile >= 100:
          raise NotImplementedError(
              "Quantile must be between 0 and 100"
          )
      combine_dim = (
          -2
          if isinstance(pred_dist, MultitaskMultivariateNormal)
          else -1
      )
      standard_normal = torch.distributions.Normal(loc=0.0, scale=1.0)
      deviation = standard_normal.icdf(
          torch.as_tensor(0.5 + 0.5 * (quantile / 100))
      )
      lower = pred_dist.mean - deviation * pred_dist.stddev
      upper = pred_dist.mean + deviation * pred_dist.stddev
      n_samples_within_bounds = (
          (test_y > lower) * (test_y < upper)
      ).sum(combine_dim)
      fraction = n_samples_within_bounds / test_y.shape[combine_dim]
      return torch.abs(fraction - quantile / 100)
  
file_path: gpytorch/gpytorch/metrics/metrics.py
imports: from math import pi
  from typing import Optional
  import torch
  from ..distributions import MultitaskMultivariateNormal, MultivariateNormal
label_desc: Use image node_id 6 for calling a global function with example usage: quantile_coverage_error(pred_dist, test_y, quantile) and returns: torch