code: def test_partial_sum_product_scale_3(
      sum_op, prod_op, scale_i, scale_j, scale_k
  ):
      f1 = random_tensor(OrderedDict(a=Bint[2], i=Bint[2]))
      f2 = random_tensor(OrderedDict(a=Bint[2], i=Bint[2], j=Bint[3]))
      f3 = random_tensor(
          OrderedDict(a=Bint[2], i=Bint[2], j=Bint[3], k=Bint[3])
      )
  
      eliminate = frozenset("aijk")
      plates = frozenset("ijk")
  
      # Actual result based on applying scaling
      factors = [f1, f2, f3]
      scales = {"i": scale_i, "j": scale_j, "k": scale_k}
      actual = sum_product(
          sum_op,
          prod_op,
          factors,
          eliminate,
          plates,
          plate_to_scale=scales,
      )
  
      # Expected result based on concatenating factors
      f4 = Cat("i", (f1,) * scale_i)
      # concatenate across multiple dims
      f5 = Cat("i", (f2,) * scale_i)
      f5 = Cat("j", (f5,) * scale_j)
      # concatenate across multiple dims
      f6 = Cat("i", (f3,) * scale_i)
      f6 = Cat("j", (f6,) * scale_j)
      f6 = Cat("k", (f6,) * scale_k)
      factors = [f4, f5, f6]
      expected = sum_product(
          sum_op, prod_op, factors, eliminate, plates
      )
  
      assert_close(actual, expected, atol=1e-4, rtol=1e-4)
  
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 45 for calling a global function with example usage: test_partial_sum_product_scale_3(sum_op, prod_op, scale_i, scale_j, scale_k) without return types