code: def _sequential_gamma_gaussian_tensordot(gamma_gaussian):
      """
      Integrates a GammaGaussian ``x`` whose rightmost batch dimension is time, computes::
  
          x[..., 0] @ x[..., 1] @ ... @ x[..., T-1]
      """
      assert isinstance(gamma_gaussian, GammaGaussian)
      assert gamma_gaussian.dim() % 2 == 0, "dim is not even"
      batch_shape = gamma_gaussian.batch_shape[:-1]
      state_dim = gamma_gaussian.dim() // 2
      while gamma_gaussian.batch_shape[-1] > 1:
          time = gamma_gaussian.batch_shape[-1]
          even_time = time // 2 * 2
          even_part = gamma_gaussian[..., :even_time]
          x_y = even_part.reshape(batch_shape + (even_time // 2, 2))
          x, y = x_y[..., 0], x_y[..., 1]
          contracted = gamma_gaussian_tensordot(x, y, state_dim)
          if time > even_time:
              contracted = GammaGaussian.cat(
                  (contracted, gamma_gaussian[..., -1:]), dim=-1
              )
          gamma_gaussian = contracted
      return gamma_gaussian[..., 0]
  
imports: import torch
  import torch.nn.functional
  from pyro.ops.gamma_gaussian import GammaGaussian, gamma_and_mvn_to_gamma_gaussian, gamma_gaussian_tensordot, matrix_and_mvn_to_gamma_gaussian
  from pyro.ops.gaussian import Gaussian, gaussian_tensordot, matrix_and_mvn_to_gaussian, mvn_to_gaussian, sequential_gaussian_filter_sample, sequential_gaussian_tensordot
  from pyro.ops.indexing import Vindex
  from pyro.ops.special import safe_log
  from pyro.ops.tensor_utils import cholesky_solve, safe_cholesky
  from .None import constraints
  from .torch import Categorical, Gamma, Independent, MultivariateNormal
  from .torch_distribution import TorchDistribution
  from .util import broadcast_shape, torch_jit_script_if_tracing
label_desc: Use image node_id 6 for calling a global function with example usage: _sequential_gamma_gaussian_tensordot(gamma_gaussian) and returns: gamma_gaussian