class_docstr: Constructs a multivariate normal random variable, based on mean and covariance.
  Can be multivariate, or a batch of multivariate normals
  
  Passing a vector mean corresponds to a multivariate normal.
  Passing a matrix mean corresponds to a batch of multivariate normals.
  
  :param mean: `... x N` mean of mvn distribution.
  :param covariance_matrix: `... x N X N` covariance matrix of mvn distribution.
  :param validate_args: If True, validate `mean` anad `covariance_matrix` arguments. (Default: False.)
  
  :ivar torch.Size base_sample_shape: The shape of a base sample (without
      batching) that is used to generate a single sample.
  :ivar torch.Tensor covariance_matrix: The covariance matrix, represented as a dense :class:`torch.Tensor`
  :ivar ~linear_operator.LinearOperator lazy_covariance_matrix: The covariance matrix, represented
      as a :class:`~linear_operator.LinearOperator`.
  :ivar torch.Tensor mean: The mean.
  :ivar torch.Tensor stddev: The standard deviation.
  :ivar torch.Tensor variance: The variance.
docstr: Constructs a new MultivariateNormal that represents a random variable
  modified by an indexing operation.
  
  The mean and covariance matrix arguments are indexed accordingly.
  
  :param idx: Index to apply to the mean. The covariance matrix is indexed accordingly.
docstr_tok: ["Constructs","a","new","MultivariateNormal","that","represents","a","random","variable","modified","by","an","indexing","operation",".","The","mean","and","covariance","matrix","arguments","are","indexed","accordingly",".",":","param","idx",":","Index","to","apply","to","the","mean",".","The","covariance","matrix","is","indexed","accordingly","."]
code: def __getitem__(self, idx) -> MultivariateNormal:
      r"""
      Constructs a new MultivariateNormal that represents a random variable
      modified by an indexing operation.
  
      The mean and covariance matrix arguments are indexed accordingly.
  
      :param idx: Index to apply to the mean. The covariance matrix is indexed accordingly.
      """
  
      if not isinstance(idx, tuple):
          idx = (idx,)
      if len(idx) > self.mean.dim() and Ellipsis in idx:
          idx = tuple(i for i in idx if i != Ellipsis)
          if len(idx) < self.mean.dim():
              raise IndexError("Multiple ambiguous ellipsis in index!")
  
      rest_idx = idx[:-1]
      last_idx = idx[-1]
      new_mean = self.mean[idx]
  
      if len(idx) <= self.mean.dim() - 1 and (Ellipsis not in rest_idx):
          # We are only indexing the batch dimensions in this case
          new_cov = self.lazy_covariance_matrix[idx]
      elif len(idx) > self.mean.dim():
          raise IndexError(f"Index {idx} has too many dimensions")
      else:
          # In this case we know last_idx corresponds to the last dimension
          # of mean and the last two dimensions of lazy_covariance_matrix
          if isinstance(last_idx, int):
              new_cov = DiagLinearOperator(
                  self.lazy_covariance_matrix.diagonal(
                      dim1=-1, dim2=-2
                  )[(*rest_idx, last_idx)]
              )
          elif isinstance(last_idx, slice):
              new_cov = self.lazy_covariance_matrix[
                  (*rest_idx, last_idx, last_idx)
              ]
          elif last_idx is (...):
              new_cov = self.lazy_covariance_matrix[rest_idx]
          else:
              new_cov = self.lazy_covariance_matrix[
                  (*rest_idx, last_idx, slice(None, None, None))
              ][..., last_idx]
      return self.__class__(mean=new_mean, covariance_matrix=new_cov)
  
imports: from __future__ import annotations
  import math
  import warnings
  from numbers import Number
  from typing import Optional, Tuple, Union
  import torch
  from linear_operator import to_dense, to_linear_operator
  from linear_operator.operators import DiagLinearOperator, LinearOperator, RootLinearOperator
  from torch import Tensor
  from torch.distributions import MultivariateNormal
  from torch.distributions.kl import register_kl
  from torch.distributions.utils import _standard_normal, lazy_property
  from ..None import settings
  from ..utils.warnings import NumericalWarning
  from .distribution import Distribution
label_desc: Use image node_id 20 for calling the MultivariateNormal obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: self