code: def _check_sarkka_bilmes(
      trans, expected_inputs, global_vars, num_periods=1
  ):
      sum_op, prod_op = ops.logaddexp, ops.add
  
      assert "time" in trans.inputs
      duration = trans.inputs["time"].dtype
      time_var = Variable("time", Bint[duration])
  
      expected = naive_sarkka_bilmes_product(
          sum_op, prod_op, trans, time_var, global_vars
      )
      assert dict(expected.inputs) == expected_inputs
  
      actual = sarkka_bilmes_product(
          sum_op,
          prod_op,
          trans,
          time_var,
          global_vars,
          num_periods=num_periods,
      )
      assert dict(actual.inputs) == expected_inputs
  
      actual = actual.align(tuple(expected.inputs.keys()))
      with compress_gaussians:
          actual = reinterpret(actual)
          expected = reinterpret(expected)
      assert_close(actual, expected, atol=1e-3, rtol=1e-3)
  
imports: import os
  import re
  from collections import OrderedDict
  from functools import partial, reduce
  import pytest
  import funsor.ops
  from funsor.domains import Bint, Real, Reals
  from funsor.interpretations import compress_gaussians, eager, eager_or_die, lazy, moment_matching, reflect
  from funsor.interpreter import reinterpret
  from funsor.optimizer import apply_optimizer
  from funsor.sum_product import MarkovProduct, _partition, dynamic_partial_sum_product, mixed_sequential_sum_product, modified_partial_sum_product, naive_sarkka_bilmes_product, naive_sequential_sum_product, partial_sum_product, partial_unroll, sarkka_bilmes_product, sequential_sum_product, sum_product
  from funsor.tensor import Tensor, get_default_prototype
  from funsor.terms import Cat, Variable
  from funsor.testing import assert_close, random_gaussian, random_tensor
  from funsor.util import get_backend
label_desc: Use image node_id 33 for calling a global function with example usage: _check_sarkka_bilmes(trans, expected_inputs, global_vars, num_periods) without return types