code: def test_distributions(state_dim, obs_dim):
      data = Tensor(torch.randn(2, obs_dim))["time"]
  
      bias = Variable("bias", Reals[obs_dim])
      bias_dist = dist_to_funsor(random_mvn((), obs_dim))(value=bias)
  
      prev = Variable("prev", Reals[state_dim])
      curr = Variable("curr", Reals[state_dim])
      trans_mat = Tensor(
          torch.eye(state_dim) + 0.1 * torch.randn(state_dim, state_dim)
      )
      trans_mvn = random_mvn((), state_dim)
      trans_dist = dist.MultivariateNormal(
          loc=trans_mvn.loc,
          scale_tril=trans_mvn.scale_tril,
          value=curr - prev @ trans_mat,
      )
  
      state = Variable("state", Reals[state_dim])
      obs = Variable("obs", Reals[obs_dim])
      obs_mat = Tensor(torch.randn(state_dim, obs_dim))
      obs_mvn = random_mvn((), obs_dim)
      obs_dist = dist.MultivariateNormal(
          loc=obs_mvn.loc,
          scale_tril=obs_mvn.scale_tril,
          value=state @ obs_mat + bias - obs,
      )
  
      log_prob = 0
      log_prob += bias_dist
  
      state_0 = Variable("state_0", Reals[state_dim])
      log_prob += obs_dist(state=state_0, obs=data(time=0))
  
      state_1 = Variable("state_1", Reals[state_dim])
      log_prob += trans_dist(prev=state_0, curr=state_1)
      log_prob += obs_dist(state=state_1, obs=data(time=1))
  
      log_prob = log_prob.reduce(ops.logaddexp)
      assert isinstance(log_prob, Tensor), log_prob.pretty()
  
file_path: funsor/test/examples/test_sensor_fusion.py
imports: from collections import OrderedDict
  import pytest
  import torch
  import funsor.ops
  import funsor.torch.distributions
  from funsor.cnf import Contraction
  from funsor.domains import Bint, Reals
  from funsor.gaussian import Gaussian
  from funsor.pyro.convert import dist_to_funsor, matrix_and_mvn_to_funsor
  from funsor.tensor import Tensor
  from funsor.terms import Subs, Variable
  from funsor.testing import random_mvn
label_desc: Use image node_id 1 for calling a global function with example usage: test_distributions(state_dim, obs_dim) without return types