code: def convert_from_symbolic_expression(
      expr,
      n_symbols=None,
      lut_functions=None,
      use_built_in_lut_functions=False,
      output_dir="my-hls-test",
      project_name="myproject",
      input_data_tb=None,
      output_data_tb=None,
      precision="ap_fixed<16,6>",
      **kwargs,
  ):
      """Converts a given (SymPy or string) expression to hls4ml model.
  
      Args:
          expr (str or sympy.Expr): Expression to convert. The variables in the expression should be in the form of
              ``x0, x1, x2, ...``.
          n_symbols (int, optional): Number of symbols in the expression. If not provided, the largest index of the variable
              will be used as the number of symbols. Useful if number of inputs differs from the number of variables used
              in the expression. Defaults to None.
          lut_functions (dict, optional): LUT function definitions. Defaults to None.
              The dictionary should have the form of::
  
                  {
                      '<func_name>': {
                          'math_func': '<func>',
                          'table_size': <table_size>,
                          'range_start': <start>,
                          'range_end': <end>,
                      }
                  }
  
              where ``<func_name>`` is a given name that can be used with PySR, ``<func>`` is the math function to
              approximate (`sin`, `cos`, `log`,...), ``<table_size>`` is the size of the lookup table, and ``<start>`` and
              ``<end>`` are the ranges in which the function will be approximated. It is **strongly** recommended to use a
              power-of-two as a range.
          use_built_in_lut_functions (bool, optional): Use built-in sin/cos LUT functions. Defaults to False.
          output_dir (str, optional): Output directory of the generated HLS
              project. Defaults to 'my-hls-test'.
          project_name (str, optional): Name of the HLS project.
              Defaults to 'myproject'.
          input_data_tb (str, optional): String representing the path of input data in .npy or .dat format that will be
              used during csim and cosim.
          output_data_tb (str, optional): String representing the path of output data in .npy or .dat format that will be
              used during csim and cosim.
          precision (str, optional): Precision to use. Defaults to 'ap_fixed<16,6>'.
          part (str, optional): The FPGA part. If set to `None` a default part of a backend will be used.
          clock_period (int, optional): Clock period of the design.
              Defaults to 5.
          compiler (str, optional): Compiler to use, ``vivado_hls`` or ``vitis_hls``. Defaults to ``vivado_hls``.
          hls_include_path (str, optional): Path to HLS inlcude files. If `None` the location will be inferred from the
              location of the `compiler` used. If an empty string is passed the HLS math libraries won't be used during
              compilation, meaning Python integration won't work unless all functions are LUT-based. Doesn't affect synthesis.
              Defaults to None.
          hls_libs_path (str, optional): Path to HLS libs files. If `None` the location will be inferred from the
              location of the `compiler` used. Defaults to None.
  
      Returns:
          ModelGraph: hls4ml model.
      """
      import sympy
  
      if not isinstance(expr, (list, set)):
          expr = [expr]
      for i, e in enumerate(expr):
          if not isinstance(e, sympy.Expr):
              expr[i] = sympy.parsing.sympy_parser.parse_expr(e)
  
      if n_symbols is None:
          n_symbols = 0
          for e in expr:
              symbols = (
                  max(
                      [
                          int(d.name.replace("x", ""))
                          for d in e.free_symbols
                      ]
                  )
                  + 1
              )
              if symbols > n_symbols:
                  n_symbols = symbols
  
      if lut_functions is None:
          lut_functions = []
      else:
          if isinstance(lut_functions, dict):
              lut_functions = [
                  LUTFunction(
                      name,
                      params["math_func"],
                      params["range_start"],
                      params["range_end"],
                      params["table_size"],
                  )
                  for name, params in lut_functions.items()
              ]
  
      layer_list = []
  
      input_layer = {}
      input_layer["name"] = "x"
      input_layer["class_name"] = "InputLayer"
      input_layer["input_shape"] = [n_symbols]
      layer_list.append(input_layer)
  
      expr_layer = {}
      expr_layer["name"] = "expr1"
      expr_layer["class_name"] = "SymbolicExpression"
      expr_layer["expression"] = [str(e) for e in expr]
      expr_layer["n_symbols"] = n_symbols
      expr_layer["lut_functions"] = lut_functions
      expr_layer["use_built_in_luts"] = use_built_in_lut_functions
      layer_list.append(expr_layer)
  
      config = create_config(
          output_dir=output_dir,
          project_name=project_name,
          backend="SymbolicExpression",
          **kwargs,
      )
  
      # config['Expression'] = str(expr)
      config["NSymbols"] = n_symbols
      config["InputData"] = input_data_tb
      config["OutputPredictions"] = output_data_tb
  
      config["HLSConfig"] = {
          "Model": {"Precision": precision, "ReuseFactor": 1}
      }
  
      hls_model = ModelGraph(config, layer_list)
  
      return hls_model
  
imports: import importlib
  import os
  import warnings
  import yaml
  from hls4ml.converters.keras_to_hls import KerasFileReader
  from hls4ml.converters.keras_to_hls import KerasModelReader
  from hls4ml.converters.keras_to_hls import KerasReader
  from hls4ml.converters.keras_to_hls import get_supported_keras_layers
  from hls4ml.converters.keras_to_hls import parse_keras_model
  from hls4ml.converters.keras_to_hls import keras_to_hls, register_keras_layer_handler
  from hls4ml.model import ModelGraph
  from hls4ml.utils.config import create_config
  from hls4ml.utils.symbolic_utils import LUTFunction
label_desc: Use image node_id 8 for calling a global function with example usage: convert_from_symbolic_expression(expr, n_symbols, lut_functions, use_built_in_lut_functions, output_dir, project_name, input_data_tb, output_data_tb, precision) and returns: hls_model