code: def test_condition(sample_shape, batch_shape, left, right):
      dim = left + right
      gaussian = random_gaussian(batch_shape, dim)
      gaussian.precision += torch.eye(dim) * 0.1
      value = torch.randn(
          sample_shape + (1,) * len(batch_shape) + (dim,)
      )
      left_value, right_value = value[..., :left], value[..., left:]
  
      conditioned = gaussian.condition(right_value)
      assert (
          conditioned.batch_shape == sample_shape + gaussian.batch_shape
      )
      assert conditioned.dim() == left
  
      actual = conditioned.log_density(left_value)
      expected = gaussian.log_density(value)
      assert_close(actual, expected)
  
      # test left_condition
      permute_conditioned = gaussian.left_condition(left_value)
      assert (
          permute_conditioned.batch_shape
          == sample_shape + gaussian.batch_shape
      )
      assert permute_conditioned.dim() == right
  
      permute_actual = permute_conditioned.log_density(right_value)
      assert_close(permute_actual, expected)
  
imports: import math
  from collections import OrderedDict
  import pytest
  import torch
  from torch.distributions import constraints, transform_to
  from torch.nn.functional import pad
  import pyro.distributions
  from pyro.distributions.util import broadcast_shape
  from pyro.ops.gaussian import AffineNormal, Gaussian, gaussian_tensordot, matrix_and_gaussian_to_gaussian, matrix_and_mvn_to_gaussian, mvn_to_gaussian, sequential_gaussian_filter_sample, sequential_gaussian_tensordot
  from tests.common import assert_close
  from tests.ops.gaussian import assert_close_gaussian, random_gaussian, random_mvn
label_desc: Use image node_id 11 for calling a global function with example usage: test_condition(sample_shape, batch_shape, left, right) without return types