code: def format(self, node):
      params = self._default_config_params(node)
  
      params["n_in"] = node.get_input_variable().dim_names[1]
      params["n_sequence"] = node.get_input_variable().dim_names[0]
      if node.get_attr("return_sequences"):
          params[
              "n_sequence_out"
          ] = node.get_output_variable().dim_names[0]
          params["n_state"] = node.get_output_variable().dim_names[1]
          params["n_out"] = node.get_output_variable().dim_names[1]
      else:
          params["n_sequence_out"] = 1
          params["n_state"] = node.get_output_variable().dim_names[0]
          params["n_out"] = node.get_output_variable().dim_names[0]
      params["config_mult_t1"] = f"config{node.index}_1"
      params["config_mult_t2"] = f"config{node.index}_2"
      params["recr_act_t"] = "{}_config{}_recr".format(
          node.get_attr("recurrent_activation"), node.index
      )
      params["act_t"] = "{}_config{}".format(
          node.get_attr("activation"), node.index
      )
      params["strategy"] = node.get_attr("strategy")
      params["static"] = (
          "true" if node.attributes["static"] else "false"
      )
      params["recr_type"] = node.class_name.lower()
      params["RECR_TYPE"] = node.class_name
  
      if node.class_name == "LSTM":
          n_recr_mult = 4
      else:  # GRU
          n_recr_mult = 3
  
      recr_config = self.template.format(**params)
  
      act_params = self._default_config_params(node)
      recr_act_params = self._default_config_params(node)
  
      act_params["type"] = node.get_attr("activation")
      recr_act_params["type"] = node.get_attr("recurrent_activation")
      if node.get_attr("return_sequences"):
          act_params["n_in"] = node.get_output_variable().dim_names[1]
          recr_act_params[
              "n_in"
          ] = node.get_output_variable().dim_names[1] + " * %i" % (
              n_recr_mult - 1
          )
      else:
          act_params["n_in"] = node.get_output_variable().dim_names[0]
          recr_act_params[
              "n_in"
          ] = node.get_output_variable().dim_names[0] + " * %i" % (
              n_recr_mult - 1
          )
  
      act_config = self.act_template.format(**act_params)
      recr_act_config = self.recr_act_template.format(**recr_act_params)
  
      mult_params1 = self._default_config_params(node)
      mult_params2 = self._default_config_params(node)
  
      mult_params1["n_in"] = node.get_input_variable().dim_names[1]
      if node.get_attr("return_sequences"):
          mult_params1["n_out"] = (
              node.get_output_variable().dim_names[1]
              + " * %i" % n_recr_mult
          )
      else:
          mult_params1["n_out"] = (
              node.get_output_variable().dim_names[0]
              + " * %i" % n_recr_mult
          )
      mult_params1["product_type"] = get_backend("vivado").product_type(
          node.get_input_variable().type.precision,
          node.get_weights("weight").type.precision,
      )
      mult_params1["reuse"] = params["reuse"]
      mult_params1["index"] = str(node.index) + "_1"
      mult_params1["nzeros"] = node.get_weights("weight").nzeros
      mult_params1["nonzeros"] = node.get_weights("weight").nonzeros
      if node.get_attr("return_sequences"):
          mult_params2["n_in"] = node.get_output_variable().dim_names[1]
          mult_params2["n_out"] = (
              node.get_output_variable().dim_names[1]
              + " * %i" % n_recr_mult
          )
      else:
          mult_params2["n_in"] = node.get_output_variable().dim_names[0]
          mult_params2["n_out"] = (
              node.get_output_variable().dim_names[0]
              + " * %i" % n_recr_mult
          )
      mult_params2["product_type"] = get_backend("vivado").product_type(
          node.get_input_variable().type.precision,
          node.get_weights("recurrent_weight").type.precision,
      )
      mult_params2["reuse"] = node.attributes["recurrent_reuse_factor"]
      mult_params2["index"] = str(node.index) + "_2"
      mult_params2["nzeros"] = node.get_weights(
          "recurrent_weight"
      ).nzeros
      mult_params2["nonzeros"] = node.get_weights(
          "recurrent_weight"
      ).nonzeros
  
      mult_config1 = self.mult1_template.format(**mult_params1)
      mult_config2 = self.mult2_template.format(**mult_params2)
  
      return (
          mult_config1
          + "\n"
          + mult_config2
          + "\n"
          + recr_act_config
          + "\n"
          + act_config
          + "\n"
          + recr_config
      )
  
file_path: hls4ml/hls4ml/backends/vivado/passes/recurrent_templates.py
imports: from hls4ml.backends.backend import get_backend
  from hls4ml.backends.template import FunctionCallTemplate, LayerConfigTemplate
  from hls4ml.model.layers import GRU, LSTM
label_desc: Use image node_id 2 for calling the RecurrentConfigTemplate obj's underlying member method code with example usage: obj.format(node) and returns: unknown