code: def test_sequential_gaussian_filter_sample_stability(num_steps):
      # This tests long-chain filtering at low precision.
      zero = torch.zeros((), dtype=torch.float)
      eye = torch.eye(4, dtype=torch.float)
      noise = torch.randn(
          num_steps, 4, dtype=torch.float, requires_grad=True
      )
      trans_matrix = torch.tensor(
          [
              [
                  0.8571434617042542,
                  -0.23285813629627228,
                  0.05360094830393791,
                  -0.017088839784264565,
              ],
              [
                  0.7609677314758301,
                  0.6596274971961975,
                  -0.022656921297311783,
                  0.05166701227426529,
              ],
              [
                  3.0979342460632324,
                  5.446939945220947,
                  -0.3425334692001343,
                  0.01096670888364315,
              ],
              [
                  -1.8180007934570312,
                  -0.4965082108974457,
                  -0.006048532668501139,
                  -0.08525419235229492,
              ],
          ],
          dtype=torch.float,
          requires_grad=True,
      )
  
      init = Gaussian(zero, zero.expand(4), eye)
      trans = matrix_and_gaussian_to_gaussian(
          trans_matrix, Gaussian(zero, zero.expand(4), eye)
      ).expand((num_steps - 1,))
  
      # Check numerically stabilized value.
      x = sequential_gaussian_filter_sample(init, trans, (), noise)
      assert torch.isfinite(x).all()
  
      # Check gradients.
      grads = torch.autograd.grad(x.sum(), [trans_matrix, noise])
      assert all(torch.isfinite(g).all() for g in grads)
  
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 22 for calling a global function with example usage: test_sequential_gaussian_filter_sample_stability(num_steps) without return types