code: def sequential_gaussian_tensordot(gaussian: Gaussian) -> Gaussian:
      """
      Integrates a Gaussian ``x`` whose rightmost batch dimension is time, computes::
  
          x[..., 0] @ x[..., 1] @ ... @ x[..., T-1]
  
      :param Gaussian gaussian: A batched Gaussian whose rightmost dimension is time.
      :returns: A Markov product of the Gaussian along its time dimension.
      :rtype: Gaussian
      """
      assert isinstance(gaussian, Gaussian)
      assert gaussian.dim() % 2 == 0, "dim is not even"
      batch_shape = gaussian.batch_shape[:-1]
      state_dim = gaussian.dim() // 2
      while gaussian.batch_shape[-1] > 1:
          time = gaussian.batch_shape[-1]
          even_time = time // 2 * 2
          even_part = gaussian[..., :even_time]
          x_y = even_part.reshape(batch_shape + (even_time // 2, 2))
          x, y = x_y[..., 0], x_y[..., 1]
          contracted = gaussian_tensordot(x, y, state_dim)
          if time > even_time:
              contracted = Gaussian.cat(
                  (contracted, gaussian[..., -1:]), dim=-1
              )
          gaussian = contracted
      return gaussian[..., 0]
  
imports: import math
  from typing import Optional, Tuple, Union
  import torch
  from torch.distributions.utils import lazy_property
  from torch.nn.functional import pad
  from pyro.distributions.util import broadcast_shape
  from pyro.ops.tensor_utils import matmul, matvecmul, safe_cholesky, triangular_solve
label_desc: Use image node_id 5 for calling a global function with example usage: sequential_gaussian_tensordot(gaussian) and returns: gaussian