code: def generate_test_cpp_sources(test_params, template):
      device = test_params.device
  
      cpp_constructor_args = test_params.cpp_constructor_args
      if cpp_constructor_args != "":
          cpp_constructor_args = f"({cpp_constructor_args})"
  
      (
          cpp_args_construction_stmts,
          cpp_forward_args_symbols,
      ) = compute_cpp_args_construction_stmts_and_forward_arg_symbols(
          test_params
      )
  
      test_cpp_sources = template.substitute(
          module_variant_name=test_params.module_variant_name,
          module_qualified_name=f"torch::nn::{test_params.module_name}",
          cpp_args_construction_stmts=";\n  ".join(
              cpp_args_construction_stmts
          ),
          cpp_constructor_args=cpp_constructor_args,
          cpp_forward_args_symbols=", ".join(cpp_forward_args_symbols),
          device=device,
      )
      return test_cpp_sources
  
file_path: pytorch/test/cpp_api_parity/module_impl_check.py
imports: import tempfile
  from string import Template
  import types
  import pprint
  import os
  import torch
  from cpp_api_parity.utils import TorchNNModuleTestParams, TORCH_NN_COMMON_TEST_HARNESS, compile_cpp_code_inline, set_python_tensors_requires_grad, move_python_tensors_to_device, add_test, compute_cpp_args_construction_stmts_and_forward_arg_symbols, serialize_arg_dict_as_script_module, compute_arg_dict, decorate_test_fn, compute_temp_file_path, generate_error_msg, is_torch_nn_functional_test, try_remove_folder
  from cpp_api_parity.sample_module import SAMPLE_MODULE_CPP_SOURCE
label_desc: Use image node_id 6 for calling a global function with example usage: generate_test_cpp_sources(test_params, template) and returns: test_cpp_sources